- From: Bramus via GitHub <sysbot+gh@w3.org>
- Date: Mon, 26 Aug 2024 09:35:12 +0000
- To: public-css-archive@w3.org
> @bramus Style queries do help with deduplication.
I’ve mentioned a similar workaround [here](https://github.com/w3c/csswg-drafts/issues/10249#issuecomment-2289192793). But that’s quite a nasty hack which requires quite some cognitive load from authors.
The recommended approach for authors always has been to use the `prefers-color-scheme` media query in their stylesheets. The nicest solution to the original issue is not to require them to do a pretty big rewrite of their styles.
> It might initially seem redundant to set `color-scheme` to be able to query it, but it fits my mental model that media queries are about the _medium_, while style queries are about the actual _styles_.
Agreed that there definitely is a conflict here: `prefers-color-scheme` is about the user’s preference, not the author’s preference.
Maybe, ideally, it’d be something like the following?
```css
@when (media(prefers-color-scheme: dark) or (document(single-color-scheme: dark)) {
…<dark-styles>
}
```
This way it’s clear that the one thing is a user’s preference, whereas the other thing is an author/document preference.
Or maybe it could be an option for something like [`@config`](https://github.com/w3c/csswg-drafts/issues/9109) that says _“Hey, I’m fine with the meta tag overriding the prefers value”_?
```css
@config {
forced-color-scheme-from-meta: true;
}
```
--
GitHub Notification of comment by bramus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10249#issuecomment-2309778794 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 26 August 2024 09:35:13 UTC