The Future of CSS: CSS Toggles
1–5 of 5 posts
Re: The Future of CSS: CSS Toggles
#2Re: The Future of CSS: CSS Toggles
#3What I'd like to see is a site-wide css-only toggle to switch between dark and light mode. The shown example wouldn't preserve the setting when navigating to a sub-page, or would it?
Isn't it what `prefers-color-scheme` [0] is for ?
[0]: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pref...
Re: The Future of CSS: CSS Toggles
#4Re: The Future of CSS: CSS Toggles
#5What I'd like to see is a site-wide css-only toggle to switch between dark and light mode. The shown example wouldn't preserve the setting when navigating to a sub-page, or would it?
> What I'd like to see is a site-wide css-only toggle to switch between dark and light mode. Isn't it what `prefers-color-scheme` [0] is for ? [0]: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pref...
All of that said, an aside: if you do implement a per-site setting, it’s a good idea to make it tri-state: light, dark, system. That way the user can remove their per-site setting if they’d prefer to go back to the default.