Re: [csswg-drafts] [css-color-adjust-1] Limits on the `only` color scheme keyword (#3881)

Actually, we can go stronger than this.  If, per #3857, we drop the `no-preference` value from the 'prefers-color-scheme' MQ, then the interaction of the MQ and 'color-scheme' becomes much simpler.  See the table at <https://drafts.csswg.org/css-color-adjust/#color-scheme-prop>

If we drop the first column, then the *only* difference between `light` and `only light`, or `dark` and `only dark`, is that if the user preference is the opposite, then `only` will still do what the author wants, but non-`only` will do the browser default. 

Note: it will **not** match the user's preference! Browser default is constrained to be `light` on the web, so both `color-scheme: light` and `color-scheme: only light` will *always* produce a light page, *regardless* of user preference.  `dark` vs `only dark` will give different results (a light page for `dark`, a dark page for `only dark`) depending on whether the user wants light or dark.

This will become more weird/problematic if we ever add more values: if we assume `sepia` exists in the future, then if the page wants `dark` but the user wants `sepia`, then it'll result in a `light` page, making *both* parties unhappy!

My suggestion is:

* make `only` a no-op; it continues to be allowed for legacy reasons. (I think we can just fold it into the `<custom-ident>` case as something to accept but ignore.)
* As the spec says today, if `color-scheme: normal`, use the browser default (light).
* If the user's preference is in the author's 'color-scheme', honor it. Otherwise, choose the author's first supported choice.

This means that `color-scheme: light` always produces a light page, `color-scheme: dark` always produces a dark page, and `color-scheme: light dark` leaves it up to the user.  In a world where `sepia` exists, if the user wants sepia, `color-scheme: light dark` will give a light page instead.

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

Received on Tuesday, 19 May 2020 23:11:41 UTC