W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2020

Re: [csswg-drafts] [css-media-queries-5] add clarification on applied order for multiple preferences (#4895)

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Wed, 25 Mar 2020 21:43:08 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-604103529-1585172587-sysbot+gh@w3.org>
There's no hierarchy; they're independent preferences that can be queried separately or together, as the page author desires.

(And notably, there's nothing about a light or dark color scheme that implies a particular level of contrast; you can do high and low contrast variations of either.)

> Can I define contrast and color scheme independently, so the cascade can do its job?

Not really right now, because dealing with either preference involves assigning to the same properties (`color`, `background-color`, etc), and ideally you want to handle all combinations of those two preferences.

*That said*, Color 5 is working on a (still *very* early stages, don't look to its details as particularly informative of a final design yet) [automatic contrast adjuster](https://drafts.csswg.org/css-color-5/#colorcontrast), where you can feed it two colors and a desired contrast ratio and it spits out one of the colors adjusted appropriately. This should, if we do it right, let you do a quick-and-dirty contrast adjuster automatically: set a `--contrast-ratio` property according to `(prefers-contrast)`, and set `--color-*` properties according to `(prefers-color-scheme)`, then actually write out your color properties by combining the two with `contrast-adjust()`. It's a bit of scaffolding, but it avoids needing to define a 3x2 (for now) set of colors for everything; instead you'd just define 2 sets of colors (light and dark) and let the function deal with contrast for you.  The results won't be as good as hand-designing all the combinations, but it should be better than nothing, and you can still do hand-authoring when desired, either totally or piecemeal.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4895#issuecomment-604103529 using your GitHub account
Received on Wednesday, 25 March 2020 21:43:10 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:02 UTC