Re: [csswg-drafts] [mediaqueries] Effect of <meta name=color-scheme> on img and video sources (#13377)

The CSS Working Group just discussed `[mediaqueries] Effect of <meta name=color-scheme> on img and video sources`, and agreed to the following:

* `RESOLVED: (prefers-color-scheme) reflects <meta name=color-scheme>. Add (bikeshed-color-scheme) to always reflect the preference coming from the browser. (pending feedback from other commenters in the issue)`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> TabAtkins: if you set `&lt;meta name=color-scheme>` it changes the used color-scheme, but media queries don't affect it<br>
&lt;RRSAgent> I have made the request to generate https://www.w3.org/2026/03/31-css-minutes.html fantasai<br>
&lt;emilio> ... the `&lt;picture>` lets you switch between multiple different sources based on media query<br>
&lt;emilio> ... if you have `&lt;picture>` but `&lt;meta name="color-scheme" content="dark">`, but os in light mode, prefers-color-scheme doesn't match<br>
&lt;emilio> TabAtkins: we could special-case picture / video to make their media query resolve differently (not in love)<br>
&lt;emilio> ... make media queries look into the meta<br>
&lt;emilio> ... or make sure that there's a way to use the used color-scheme of the video / picture<br>
&lt;emilio> q+<br>
&lt;emilio> ... but would require more interaction with HTML and not fix any existing light / dark mode picture<br>
&lt;emilio> ... thoughts?<br>
&lt;emilio> ... my proposal would be to make the media query use the meta color scheme<br>
&lt;emilio> ... I think it's the cleanest way to solve several of these<br>
&lt;emilio> ... other solutions would be great<br>
&lt;emilio> ... the current state is quite bad<br>
&lt;astearns> ack fantasai<br>
&lt;emilio> fantasai: alternative proposal, new `color-scheme` media query that reflects the document, so `prefers-color-scheme` reflects the user preferred color scheme<br>
&lt;florian> I think I like fantasai's proposal<br>
&lt;emilio> fantasai: so you can do your queries for the `color-scheme` without interacting with the preferred value<br>
&lt;TabAtkins> emilio: I dont' like that proposal. `prefers-color-scheme` already takes into account the embedder page; if your outer page is in light mode, an iframe will match (prefers-color-scheme: light)<br>
&lt;astearns> ack emilio<br>
&lt;TabAtkins> emilio: I don't like any of them too much, but I think Tab's is the least destructive<br>
&lt;fantasai> emilio: why would you mismatch?<br>
&lt;fantasai> TabAtkins: You might have a switcher on the page.<br>
&lt;fantasai> TabAtkins: Do that by setting the meta<br>
&lt;fantasai> emilio: Didn't we have scripted control thing?<br>
&lt;fantasai> TabAtkins: yes, but also, one page might be forced dark mode while you're using generic assets that are styled for both<br>
&lt;fantasai> emilio: This would only affect things in the markup, right?<br>
&lt;fantasai> emilio: For other things you'd use light-dark function<br>
&lt;fantasai> emilio: Feels a bit annoying in that preloading for picture resources, now would need to account for that.<br>
&lt;fantasai> emilio: E.g. parsing HTML speculatively, you assume that the media is going to match and now you need to account for the meta tag changing, which is a bit wasteful<br>
&lt;fantasai> TabAtkins: while potentially wasteful, it is avoiding loading the wrong resource<br>
&lt;astearns> s/avoiding loading/avoiding displaying/<br>
&lt;fantasai> TabAtkins: That would only be an issue if you changed the meta well after preload<br>
&lt;fantasai> emilio: Your scanner would need to account for the meta<br>
&lt;fantasai> TabAtkins: how does it interact with viewport meta's today?<br>
&lt;fantasai> emilio: It doesn't :)<br>
&lt;fantasai> emilio: It's explicitly bad because [something]<br>
&lt;TabAtkins> s/something/without the viewport meta, the viewport size depends on the content in some ways/<br>
&lt;fantasai> emilio: Any other meta tag other than device-width is realistically not common enough to optimize<br>
&lt;fantasai> emilio: tldr, I think Tab's proposal is the least bad but still eh<br>
&lt;astearns> ack fantasai<br>
&lt;emilio> fantasai: tabs and my proposal is effectively the same other than with other name right?<br>
&lt;emilio> emilio: yeah but I still think changing prefers-color-scheme is fine<br>
&lt;emilio> fantasai: there were some concerns about that<br>
&lt;emilio> ... we wouldn't have done the embedder thing if we had this<br>
&lt;emilio> emilio: but then prefers-color-scheme is pretty useless<br>
&lt;emilio> fantasai: you'd use prefers-color-scheme to set the initial switcher state or so<br>
&lt;emilio> ... we have several meta tags that are going to affect media queries, the viewport meta tag, the color-scheme, the text-scale which will also affect media queries<br>
&lt;florian> q+<br>
&lt;fantasai> emilio: Not sure I buy need for distinguishing color-scheme and prefers-color-scheme<br>
&lt;fantasai> emilio: prefers-color-scheme already responds to the embedding page color scheme<br>
&lt;fantasai> emilio: We need a different concept for this, because the used color scheme for lacking a meta tag is light.<br>
&lt;fantasai> emilio: even if that's not the preferred color scheme<br>
&lt;fantasai> emilio: Given how it's already not quite the user's preferred color scheme<br>
&lt;fantasai> emilio: I find it a bit more acceptable to re-use it.<br>
&lt;fantasai> emilio: If it wasn't influenced by the embeder page, then I could see the distiction being meaningful<br>
&lt;fantasai> emilio: but right now it's pretty arbitrary<br>
&lt;astearns> q+<br>
&lt;astearns> ack florian<br>
&lt;emilio> florian: I think I'd have a strong preference if we were in a clean slate<br>
&lt;TabAtkins> Just as a reminder, the only argument we had for (prefers-color-scheme) remaining unchanged is so that certain data-collection schemes can still tell what the user preferred even on pages with a &lt;meta color-scheme> manually set<br>
&lt;emilio> ... the fact we're not I think I still lean towards fantasai's approach but less strongly<br>
&lt;emilio> ... if a page has mixed color-schemes<br>
&lt;emilio> ... let's say you have a "spec browser" with its own picker which sets the meta<br>
&lt;emilio> ... within that, the color-scheme media would respond to the meta, which ??<br>
&lt;emilio> ... specs have light and dark mode<br>
&lt;emilio> ... you might have a preference for that<br>
&lt;emilio> ... instead of viewing them and it's not in an iframe<br>
&lt;emilio> ... so you have a picker in the gallery but having access to the OS level preference would allow you to render the iframe in the right color scheme<br>
&lt;emilio> emilio: ah so you have an iframe and you want the "system" color scheme on the iframe<br>
&lt;emilio> florian: how locked in are we on the iframe thing?<br>
&lt;emilio> ... if we had a color-scheme media query, we could use _that_ for the iframe<br>
&lt;TabAtkins> emilio: so my problem with (color-scheme) is that, it's the MQ you want for everything in practice. We have all this code and examples already using (prefers-color-scheme)...<br>
&lt;TabAtkins> emilio: so when would you want the actual (prefers-color-scheme)?<br>
&lt;TabAtkins> emilio: I agree in an ideal world we'd have done (color-scheme) originally, but...<br>
&lt;fantasai> TabAtkins: The original argument for keeping them distinct was collecting user data<br>
&lt;fantasai> emilio: For Firefox browser UI we need this distinction<br>
&lt;fantasai> emilio: We need to use the user's preference for the UI<br>
&lt;fantasai> emilio: I added a new MQ with a different name for the UI vs the web content<br>
&lt;fantasai> emilio: Given massive amount of code using 'prefers-color-scheme' that would need to change<br>
&lt;fantasai> emilio: can we instead add a new MQ for the "system preferred scheme"?<br>
&lt;fantasai> florian: I think we do want both. Though naming whatever.<br>
&lt;fantasai> emilio: Internally we have concept of "used" and "preferred" color schemes<br>
&lt;fantasai> emilio: I don't have a great name... it's not really the system color scheme<br>
&lt;fantasai> emilio: Potentially 3 color schemes involved<br>
&lt;fantasai> emilio: 1. One that the page sets.<br>
&lt;fantasai> emilio: 2. One that the embedder sets.<br>
&lt;fantasai> emilio: 3. The browser's color scheme.<br>
&lt;fantasai> emilio: 4. OS color scheme.<br>
&lt;fantasai> ....<br>
&lt;fantasai> emilio: There's the top-level value that the browser sets for the top-level page.<br>
&lt;fantasai> emilio: Then there's the one that your embedder sets, e.g. on an iframe.<br>
&lt;fantasai> emilio: Then there's the one set by the iframe document itself.<br>
&lt;fantasai> emilio: We only have name for one of these<br>
&lt;fantasai> emilio: Least disruptive approach is introducing a new name for the one you most likely don't want to use.<br>
&lt;fantasai> astearns: Emilio, you're worried about compat because we already have documentation and use of prefers-color-scheme<br>
&lt;fantasai> astearns: If we follow Elika's proposal to introduce a new MQ, then content would need to move over to the new feature.<br>
&lt;miriam> q+<br>
&lt;fantasai> astearns: But if we follow Tab's proposal to re-interpret prefers-color-scheme, then we break existing behavior / uses.<br>
&lt;fantasai> astearns: With both ideas, we'd be changing the prefers-color-scheme in some way...<br>
&lt;fantasai> astearns: Maybe we can shift to better names for things?<br>
&lt;fantasai> emilio: Not sensible. A lot of SVG icons using prefers-color-scheme right now. Changing that beahvior would break things.<br>
&lt;astearns> ack astearns<br>
&lt;fantasai> emilio: With Tab's proposal, if you only have one &lt;meta> value then the behavior changes, but only if you have one of them.<br>
&lt;fantasai> astearns: Then we're locked into not quite ideal name.<br>
&lt;astearns> ack miriam<br>
&lt;fantasai> miriam: One other use case, there are variations. Lighter light modes, and darker dark modes, and darker light mods, and lighter dark modes.<br>
&lt;fantasai> miriam: So reasonable to say that you're in a dark mode with a light mode preference, and combine these two preference to choose.<br>
&lt;fantasai> emilio: Maybe use ua-prefers-color-scheme or something?<br>
&lt;fantasai> emilio: And that gets you the top-level preference.<br>
&lt;fantasai> emilio: If there wasn't tons of existing content, Elika's suggestion is strictly better.<br>
&lt;fantasai> TabAtkins: Proposal: Go ahead and change the prefers-color-scheme on the top-level page to follow color-scheme meta value.<br>
&lt;fantasai> TabAtkins: Also add a new media query that only responds to the user's preference, ignoring anything the content does.<br>
&lt;fantasai> fantasai: So like prefers-color-scheme reflects the color scheme resolved via &lt;meta color-scheme>, and user-color-scheme reflects the user preference always.<br>
&lt;TabAtkins>  ua-prefers-color-scheme<br>
&lt;TabAtkins> (name technically TBD)<br>
&lt;fantasai> TabAtkins: And the JS API would not change the new one.<br>
&lt;florian> wfm<br>
&lt;fantasai> fantasai: Suggest we summarize the proposal into the issue, then resolve once we can cycle back to the people who had opinions.<br>
&lt;TabAtkins> PROPOSED: (prefers-color-scheme) reflects &lt;meta name=color-scheme>. Add (bikeshed-color-scheme) to always reflect the preference coming from the browser.<br>
&lt;florian> +1<br>
&lt;TabAtkins> PROPOSED: (prefers-color-scheme) reflects &lt;meta name=color-scheme>. Add (bikeshed-color-scheme) to always reflect the preference coming from the browser. (pending feedback from other commenters in the issue)<br>
&lt;TabAtkins> RESOLVED: (prefers-color-scheme) reflects &lt;meta name=color-scheme>. Add (bikeshed-color-scheme) to always reflect the preference coming from the browser. (pending feedback from other commenters in the issue)<br>
&lt;iank_> are we doing any other issues today? or just republishing stuff?<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13377#issuecomment-4166335486 using your GitHub account


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

Received on Tuesday, 31 March 2026 23:30:23 UTC