Multiple color palettes across site #41753
Unanswered
joeyjurjens
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
Yes, it’s possible. You just need to use CSS variables (--bs-*) instead of SCSS variables ($primary) and scope them inside your palette class. For example: Then, any Bootstrap component inside .color-palette-1 will automatically use these colors without manually redefining all classes. Your SCSS loop can dynamically generate these variables from your palette map. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Bootstrap(5) has a color system, these can be modified by scss but also by css. Bootstrap components then use those colors to try and "fit" in.
I'm trying to have multiple color palettes on my site, and I have something like this;
I'm trying to come up with a solutin, when a class like;
Is on a div, to set colors like primary & secondary (but also BG, text color) and components would then "read' those values, rather than the ones in :root.
For example, I have one "default" color palette in my site, which is applied like how you normally do so
This works fine, components inherit this correctly which is as expected.
But I'm looking for a way to make components work based on the color palette class, without having to manually set ALL those possible css classes, but rather being able to just set some colors like above.
Is this possible?
Beta Was this translation helpful? Give feedback.
All reactions