-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Provide variables for theme-colors #23908
Comments
Hi @kriim, I am trying to understand the use case: $theme-colors: (
primary: red,
....
} What am I missing? |
Ah, sorry, I should have mentioned this. I did this without touching the actual Bootstrap Sass files. I included Bootstrap using npm as I don't want to maintain a copy of the bootstrap files if possible. Assume a
For the sake of completeness, the following worked fine with v4-alpha.6:
|
Thanks for the clarification, 👍 |
@kriim This is what you have in mind, right? |
@andresgalante Yes, that is exactly what I had in mind 👍. Thanks for the quick resolution :). If I had seen your reply earlier, I also would have been happy to send a PR. |
Sorry, this is your idea, if you want close my PR and send it yourself. |
I'm totally fine with that ;). That was sort of an excuse that I haven't done it myself. |
After looking at your changes I saw that #23260 already introduced a way to customize the theme colors, the following works also fine (will get into beta 2):
But there was some discussion on #23260 if the variables should exist anyways.
So I guess we can include the theme variables ... |
👍 make sense, I'll close the PR |
By 'I guess we can include the theme variables' I actually meant that we could merge your PR :). As I understood the comments on #23260 the maps are only for looping over the theme colors to generate button variants etc. The variables may still be useful for people who are defining their own Sass styles based on Bootstrap:
(It's easier than getting the values from a map) |
right, I'll leave it open and let mdo decide. |
Yes 👍 , sorry for the confusion. |
I understand the appeal of separate variables, but it definitely diminishes the usefulness of the maps. Say you want to change a color—that's straightforward enough. But if you want to add a new one, you have to declare the variable and add it to the map. Not a ton of work, but it takes away some of the ease of use here for what amounts to a syntax change for snagging a color. |
How about separating the variables from the colors file? @include 'bootstrap/colors'
$theme-colors: () !default;
$theme-colors: map-merge((
"primary": $my-custom-color,
"secondary": $gray-600,
"success": $color3,
"info": $cyan,
"warning": $yellow,
"danger": $red,
"light": $gray-100,
"dark": $gray-800
), $theme-colors);
@include 'bootstrap/variables' Presently we can't EDIT: Apparently 0bc39aa fixes this issue, but it didn't ship in Beta 1. |
Pull request #22836 introduced the two color maps
colors
andtheme-colors
:While updating a test project to v4-beta I noticed that it isn't possible anymore to override the
theme-colors
properly. To overridetheme-colors.primary
one had to change the variableblue
.Would it be possible to introduce variables for the
theme-colors
which are then used in the color map? This way one could override single elements of the theme colors without doing strange things like$blue: red;
or having to redefine the wholetheme-colors
map (while making sure that all other used variables are already defined, e.g.$green
).My suggestion is to do something like this:
The text was updated successfully, but these errors were encountered: