-
-
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
Most components don't support theme/dark mode theme color changes #37976
Comments
I found the following problems that don't respect the current theme:
|
Different, but related I think: setting something like Imagine setting Card titles seems to escape the problem, but only because a) Setting If I'm doing things the wrong way, obviously I don't know what the right way is. :-) This isn't a theming issue per se; all of these examples fall into the "light" theme. But. But it seems like some concept is missing. I can't define one universal headings color when that color will be used on various backgrounds? It seems like anywhere you can define a color — at least, a text color — you need to be able to define two: one for use on "light" backgrounds, and one for use on "dark" backgrounds. The contrast ratio helper would then choose which one to use. Or something like that. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I think I'd prefer them to just swap over. If you design/layout in light mode and use .bg-dark. It'll switch to the .bg-light color in dark mode. |
Dark and light should have the names changed but still exist. Generally speaking light is a slightly different color from the background color and dark is higher contrast from the background color. I'd really like to see them keep some color like those two but name them something more appropriate. |
Prerequisites
Describe the issue
Even though the current release is only in alpha, the dark mode/theming support is quite suboptimal and it hurts much more than how much it solves.
Defining default theme colors by default should flow through to dark mode.
Components don't respect theme colors correctly when switching to dark mode. Cards, for example, don't use the theme's CSS variables, they use the color's SCSS variables directly, thus the colors defined in _variables-dark don't even matter. This prevents users from defining a dark mode alternative theme, and further, it prevents users from defining additional themes altogether.
The above, for example, can be attributed to the following compiled CSS:
This comes from _color-bg.scss. These rules should always refer to CSS variables instead of the raw SCSS values so they can be overridden at runtime.
The problem is non-fully systematic and inconsistent.
bg-#{$color}
andtext-#{$color}
work correctly.text-bg-#{$color}
works incorrectly.link-#{$color}
is correct, althoughlink-#{$color}:hover
andlink-#{$color}:active
are incorrect.Reduced test cases
The issue is visible on the Bootstrap docs page.
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
Microsoft Edge
What version of Bootstrap are you using?
5.3.0-alpha1
The text was updated successfully, but these errors were encountered: