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
Added new colors to $theme-colors but related classes are not created for text and background colors #35297
Comments
@bkilinc https://getbootstrap.com/docs/5.1/utilities/background/#utilities-api Existing Utilities: CODE // Import utilities first
@import "~bootstrap/scss/utilities";
// After utilites, use map-merge to add your custom colors
// Background Colors
$utilities: map-merge(
$utilities,
(
"background-color": (
property: background-color,
class: bg,
local-vars: (
"bg-opacity": 1,
),
values:
map-merge(
// Your custom colors
$custom-colors,
map-merge(
$utilities-bg-colors,
(
"transparent": transparent,
)
)
),
),
)
);
// Text Colors
$utilities: map-merge(
$utilities,
(
"color": (
property: color,
class: text,
local-vars: (
"text-opacity": 1,
),
values:
map-merge(
// Your custom colors
$custom-colors,
map-merge(
$utilities-text-colors,
(
"muted": $text-muted,
"black-50": rgba($black, 0.5),
"white-50": rgba($white, 0.5),
"reset": inherit,
)
)
),
),
)
); |
so $theme-colors affect some components and it may not affect some other components. May be this should be documented in variables file. |
The maps that are used for these are built in Instead of just $theme-colors: map-merge($theme-colors, $custom-colors); do $theme-colors: map-merge($theme-colors, $custom-colors);
$theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
$utilities-colors: map-merge($utilities-colors, $theme-colors-rgb);
$utilities-text: map-merge($utilities-text, $utilities-colors);
$utilities-text-colors: map-loop($utilities-text, rgba-css-var, "$key", "text");
$utilities-bg: map-merge($utilities-bg, $utilities-colors);
$utilities-bg-colors: map-loop($utilities-bg, rgba-css-var, "$key", "bg"); |
This works. But, it isn't beautiful. |
I solved the problem. ------------------------add-source--------------------------------------- $theme-colors: map-merge($theme-colors, $custom-theme-colors); @each $color, $value in $theme-colors { |
Prerequisites
Describe the issue
I added custom colors to $theme-colors map, btn-, link- colors are generated perfectly but text- and bg- colors are not generated. I guess it should behave same.
my custom.scss file is as follows.
as a result ;
Reduced test cases
include file at top;
bg-primary-light, text-primary-light should be generated
What operating system(s) are you seeing the problem on?
Linux
What browser(s) are you seeing the problem on?
Firefox
What version of Bootstrap are you using?
v5.1.3
The text was updated successfully, but these errors were encountered: