Re: [csswg-drafts] [mediaqueries] Effect of <meta name=color-scheme> on the (prefers-color-scheme) MQ (#10249)

As an author, if I had a style query, I would rarely use a media query for this purpose (being the source of truth for the dark colors on the page). As it would work only on the top level, and for any nested component where I'd want to invert the color scheme, it won't work. And it is already very easy for an author to misinterpret how media query works, and use it for components, breaking them when they are inserted into an inverted context.

Another useful distinction between a media query and a style query in this case would be that you could implement a single dark theme, _and still_ adapt it to the user preference.

If the _user_ prefers a light theme, that likely means their browser chrome and other windows around would have a light theme. An author, implementing a dark color scheme, can take this into account and make the colors more contrast, so the elements on the page won't be lost.

But if the user preference matches the color scheme, we can adjust the colors and make them not as contrasting, making it so the bright elements on the page do not light up the room.

Similarly, we could also implement a single light color scheme, but adapt it to the user preference when the user prefers a dark one, and dim it.

Another possible case, on the user land, is custom style overrides for a page. If the page gets the value of the media query from HTML, the user loses an ability to write their styles that adapt to the user preference, as at this point there is no way to get this information. I guess, if we'd specify it so we somehow _could_ switch the media query from CSS, via `@config` or something, it could help with this use case. But that would be a precedent for allowing overriding a media query value from CSS.

To sum up, I think there is a useful distinction between being able to ask “what the user wants?” and “what is the applied color scheme?”, and allow authors use a media query for one, and a style query for another, allowing reconciling the differences as a part of the design process.

I'll be ok with the `<meta>` impacting the media query, if both an author and a user will still be able to somehow get the _actual_ value of `prefers-color-scheme` and adjust things accordingly.

-- 
GitHub Notification of comment by kizu
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10249#issuecomment-2322822078 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 31 August 2024 08:05:05 UTC