-
Notifications
You must be signed in to change notification settings - Fork 55
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
Dark mode #117
Comments
dark mode would quite double the size of css. |
Using CSS custom properties, this should be quite easy and only cost a new declaration block redefining some variables. body {
--background: white;
--color: black;
}
.component {
background: var(--background);
border-color: currentColor;
color: var(--color);
}
.is-dark {
--background: black;
--color: white;
} By setting main color scheme on body, you get it for free everywhere as a default. And by using a utility class to switch to dark theme, you'll be able to use it on a component, on an entire section, or even directly on body to globally use dark theme. And being lazy would be good: ensure using IMHO this is the best possible approach, but it's highly related to browser support: that means no dark mode for IE11… |
I reply to myself on this: Might try the same way using Is the "for all components" thing serious? If it is, I guess that dark mode should probably not be component specific but application specific: making a whole Boosted dark mode. I've done this before… |
Maybe check SNCF's Bootstrap fork, which has a dark mode |
@PigeardSylvain FWIW, since v5 dropped IE11 support, my suggestion using custom properties should be fine :) Things that worked in v4:
|
Discussions in Bootstrap are taking place in #27514 with an interesting suggestion by mdo. |
Bootstrap added dark variants to some components, noticeably carousel and dropdown. Don't think it's a safe way to, though. |
Some useful ressources about the prefers-color-scheme media query: |
This should not be handled as a user preference since it's a branding choice. Supporting user choice is a great idea but dark mode (in that case) is not about users. |
A dark mode is needed for all components.
Stencil

The text was updated successfully, but these errors were encountered: