-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
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
Should the color mode expose a variable or event that can be used by third-party components? #39266
Comments
Are you talking about the color mode value used for the whole page? Because the color mode can be used contextually within the page too.
Our Do you have some technical suggestions based on what already exists in Bootstrap? |
Yes, I mean that when the color mode of the entire page level is modified by the user through buttons, can know that the color mode of the page has been adjusted through event monitoring without refreshing the page. I understand that color mode can change the color mode locally in the page, but I currently don't know the relevant scenarios where it is needed.
Yes, that's fine if there is.
There is not |
You can use css variables for this. e.g. in your css you have something like this:
We can see that $blue is defined as a scss variable
Then again is scss we have somehting like
But these do not appear to be used or fully supported in bootsrap when switching from say light to dark mode. What we do have though are examples where it does. e.g. --bs-body-color
also
so here you can access like element: var(--bs-blue) Interesting the only references to the --bs-body-color variable I can find are
and
Whats interesting about this is assigning or overriding one css variable with another in the scss> Ok after a bit more investigation I can see it is being set in _reboot.scss like so:
and then for dark mode we could do
Also you can change this value in a differrent context. I think one issue with colours in bootstrap is they use a combination of css and scss variables. Maybe this will be rationalised in boostrap 6. Is there a version of boostrap 6 available yet? |
Prerequisites
Proposal
Should a parameter of the current color mode value be exposed for use by other components?
And whether there should be an active event that can be monitored when the color mode of the page changes.
Motivation and context
For example, when using other components on the page, third-party components also support bright mode and other mode switching, and can be modified synchronously with the bootstrap color mode status. Should bootstrap provide convenience for this?
The text was updated successfully, but these errors were encountered: