How to add theme $custom-colors using default BS names w/o duplication? #36720
-
|
Since I can't seem to remember what colors I assign to BS's default theme colors (i.e., primary, info, success warning, danger), I want to use specific color-named themes. However, when I do I get dupplication in the :root of the default colors I've redefined in my scss. In my custom boostrap.scss file, i've specified the following: While I get the new named themes (e.g., .btn-darkred) that I want, the CSS variables bs-red, --bs-orange, --bs-yellow, and --bs-cyan are declared twice in the :root. Is there a way to avoid this so that redefined BS colors assign to $custom-colors appear only once in the :root declaration? If there isn't an easy way, I suggest that bootstraps functions automatically detect duplicate color names. It's not a big issues since it's only a few lines of extra code, but as semi-perfectionist, I am curious to learn if there is away to accomplish this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
Not exists the tools to removing duplicated declarations of custom CSS variables, because tools can't understand is this variable is duplicated or is correct redeclared variable. @each $color, $value in map-merge-multiple($colors, $theme-colors, $custom-colors) {
--#{$variable-prefix}#{$color}: #{$value};
} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Not exists the tools to removing duplicated declarations of custom CSS variables, because tools can't understand is this variable is duplicated or is correct redeclared variable.
You can merge single
@eachcycles of color arrays$colors,$theme-colorsand$custom-colorsin_root.scss: