Post

QQ about Dark Mode Toggles on websites How many options do you show to users? - Three values: System, Light, or Dark - Two values: Light, Dark (with one of them mapping to “System” behind the scenes). Why the one or the other? (I have an opinion about it, but I’m looking for external input)

Three values, follow system is quite different intent wise from picking a specific theme. If my system automatically changes at night to dark mode I want that behaviour. But also I light want this specific site to always remain light mode.

as a developer, same. as a (tech savvy) user, i really just want browsers to easily let me override prefers-color-scheme on a per-website basis

Blasphemous I know. But failing them giving the user an option they should give developers better primitives to implement it. Like say scripting control of preference media queries 😉.

Once browsers update the media query to reflect the page color-scheme, do you think there’s still a strong need to the User Preferences API? Toggling the color-scheme meta tag with JS will have a similar effect.

Yes for two reasons, I think the persistence will help make things work more seamlessly. But also there's more than just color scheme preference too so it's still useful for contrast, for example. Also fwiw I don't personally think that mentioned change is a great idea, but we'll see how it goes.

I don't think it materially helps authors much and we should probably be pushing people towards using -light-dark() instead. That way their components automatically adapt if a section of the page has an opposite color scheme.

Embedding dark sections in a light page or vice versa is relatively niche. I do prefer to use light-dark() but the media query is useful for setting values other than colors and images/gradients, particularly once the if() syntax ships.

I think we need the container query conditions in html too though. Web components are never gonna know their context.

I'm hopeful, it's mostly a case of finding time to push it forwards. I might try to at least finish off the implementation in chromium to do the persistence.

0 reposts2 likes

No replies yet.