Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom theme colors map-loop to Buttons/Text Color/Bg Color removing out-the-box Bootstrap classes #35201

Closed
tovutifunk opened this issue Oct 14, 2021 · 1 comment

Comments

@tovutifunk
Copy link

Last two lines remove text-white text-black bg-body:
$utilities-text-colors: map-loop($utilities-colors, rgba-css-var, "$key", "text");
$utilities-bg-colors: map-loop($utilities-colors, rgba-css-var, "$key", "bg");

How are we able to create map loops with our custom colors and avoid out of the box Bootstrap 5 classes from being removed based on the code above?


I thought the method mentioned by @nsmeele worked great.
That after:

$theme-colors: map-merge($theme-colors, $extra-theme-colors );

we also need to add these 4 lines:

$theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
$utilities-colors: map-merge($theme-colors, $utilities-colors);
$utilities-text-colors: map-loop($utilities-colors, rgba-css-var, "$key", "text");
$utilities-bg-colors: map-loop($utilities-colors, rgba-css-var, "$key", "bg");

and all the color classes gets generated properly.

I've also looked at this documentation and it works well as well, but the problem with this is that this should only be used when you have some color for which you only need the background and text classes but not the buttons and other things. Also, this approach will not generate the rgb values. So, all the classes will have --bs-bg-opacity: 1 which will remain unused.

Originally posted by @isaumya in #34734 (comment)

@tovutifunk tovutifunk changed the title I think the method mentioned by @nsmeele works great. Custom theme colors map-loop to Buttons/Text Color/Bg Color removing out-the-box Bootstrap classes Oct 14, 2021
@mdo
Copy link
Member

mdo commented Oct 15, 2021

#34756

@mdo mdo closed this as completed Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants