Re: [csswg-drafts] [mediaqueries-5] How does script control of preferences work with forced color schemes? (#11575)

The CSS Working Group just discussed `[mediaqueries-5] How does script control of preferences work with forced color schemes?`, and agreed to the following:

* `RESOLVED: Script preferences and user preferences have identical expressivity. Order of priority (least to most) is: OS, UA, user, site, forced overrides (forced-colors mode or other forced automatic color conversions)`
* `RESOLVED: Script preferences and user preferences have identical expressivity. Order of priority (least to most) is: OS, UA, user, preferences API, forced overrides (forced-colors mode or other forced automatic color conversions)`

<details><summary>The full IRC log of that discussion</summary>
&lt;florian> s/people will/people writing HTML attributes will/<br>
&lt;JoshT> lwarlow: to summarise, CSS media queries 5 has API for a website to control the value that's used for various user pref queries<br>
&lt;JoshT> ... e.g. colour scheme, reduced motion, etc<br>
&lt;JoshT> ... one weird thing is if you have your website set with the color scheme of 'light dark' dark and then set a pref for light mode...<br>
&lt;JoshT> ... if your browser does auto dark mode, auto dark mode will win<br>
&lt;TabAtkins> q+<br>
&lt;JoshT> ... i think that behaviour is wrong<br>
&lt;JoshT> ... this would effecively mean 'light only'<br>
&lt;JoshT> ... this is not new behaviour so we're not ignoring the user agent<br>
&lt;JoshT> ... so I think this should be interpretted as 'light only'<br>
&lt;Rossen> ack TabAtkins<br>
&lt;JoshT> TabAtkins: agreed. think the layering we want is that this sets the last word on what the pref is<br>
&lt;JoshT> ... on purpose so you can use a site based theme picker and have it win over whatever you do on your OS for other reasons<br>
&lt;JoshT> +1<br>
&lt;JoshT> ... if script sets light or dark, that is what the page should act on in all cases<br>
&lt;bramus> +1<br>
&lt;davidjmarland> q+<br>
&lt;Rossen> ack davidjmarland<br>
&lt;JoshT> davidjmarland: confirming, so if a script sets the preference... that means if the user actions the script right?<br>
&lt;JoshT> TabAtkins: this API lets the page set what the user preference is<br>
&lt;JoshT> ... in theory, you could do whatever. in theory, you could also ignore the user preference<br>
&lt;JoshT> davidjmarland: so sites can already ignore this anyway?<br>
&lt;JoshT> lwarlow: if anyone thinks we should have user activation of the API, we should open a separate issue for that<br>
&lt;TabAtkins> (we have raised the user-activation issue already, and decided against it, for the exact reason of "you can just ignore the MQ anyway")<br>
&lt;JoshT> fantasai: I'm always confused by light only and dark only<br>
&lt;alisonmaher> q+<br>
&lt;JoshT> TabAtkins: the only keyword is actually not relevant to this. this is actually about what gets the final say<br>
&lt;JoshT> davidjmarland: I was thinking of the scenario if something sets dark mode higher up and the website could disable it<br>
&lt;Rossen> ack alisonmaher<br>
&lt;JoshT> alisonmaher: how does this interact with forced colours mode?<br>
&lt;JoshT> TabAtkins: yes, forced colour schemes are at a different level and just ignore everything in your styles<br>
&lt;JoshT> fantasai: don't they tweak the media query to match accordingly<br>
&lt;JoshT> lwarlow: yes it can override the media query. expectation is that would win in this case<br>
&lt;florian> q?<br>
&lt;JoshT> ... this issue is around a separate thing: the forced colour schemes<br>
&lt;JoshT> ... I don't know if it's actually shipped in any browsers<br>
&lt;JoshT> ... but chrome has a feature to make up a dark mode theme on pages that don't have dark mode<br>
&lt;fantasai> So I think what we're trying to say is that the script preferences can express the same things as the user preferences, and the priority order is (least to most): OS, UA, user, site, forced-colors<br>
&lt;JoshT> florian: but if it wins over the media query and ...<br>
&lt;lwarlow> Yes<br>
&lt;JoshT> fantasai: we're just saying script preferences express the same as the user preference<br>
&lt;lwarlow> forced colors will always win<br>
&lt;JoshT> ... and least to most priority is ???<br>
&lt;fantasai> PROPOSED: Script preferences and user preferences have identical expressivity. Order of priority (least to most) is: OS, UA, user, site, forced-colors override<br>
&lt;JoshT> Rossen: are we doing the original proposal?<br>
&lt;JoshT> TabAtkins: the forced colour scheme stuff and auto dark mode adjustments that chromium has behind a flag...<br>
&lt;JoshT> ... the actual forced colours wins over colour scheme preferences<br>
&lt;florian> s/but if it wins over the media query and .../Forced colors doesn't only win over MQ, it also changes what the MQ is, we don't want to hide that so that people can respond<br>
&lt;JoshT> ... auto dark mode is a global page thing. that should lose to the script setting in terms of prefers-color-scheme MQ<br>
&lt;JoshT> Rossen: what you said still resonates with fantasai's proposal<br>
&lt;fantasai> PROPOSED: Script preferences and user preferences have identical expressivity. Order of priority (least to most) is: OS, UA, user, site, forced overrides (forced-colors mode or other forced automatic color conversions)<br>
&lt;bramus> +1<br>
&lt;lwarlow> +1<br>
&lt;davidjmarland> +1<br>
&lt;fantasai> RESOLVED: Script preferences and user preferences have identical expressivity. Order of priority (least to most) is: OS, UA, user, site, forced overrides (forced-colors mode or other forced automatic color conversions)<br>
&lt;JoshT> RESOLVED: Script preferences and user preferences have identical expressivity. Order of priority (least to most) is: OS, UA, user, preferences API, forced overrides (forced-colors mode or other forced automatic color conversions)<br>
&lt;lwarlow> HD resolution<br>
</details>


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


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

Received on Wednesday, 18 March 2026 17:00:52 UTC