Re: [csswg-drafts] [mediaqueries] Effect of <meta name=color-scheme> on the (prefers-color-scheme) MQ (#10249)

Focusing on the style query: I don’t think that will be a closing solution as it would require authors to duplicate their code:

```css
@media (prefers-color-scheme: dark) {
  …<dark-styles>
}

@container style(color-scheme: dark) {
  …<dark-styles>
}
```

It’s also no different than simply checking for the presence of the meta tag in the head

```css
@media (prefers-color-scheme: dark) {
  …<dark-styles>
}
html:has(meta[name="color-scheme"][content="dark"]) {
  …<dark-styles>
}
```

In both cases you end up with duplicated code, which is not ideal. That code duplication issue was also one of the reasons behind the Web Preferences API, so that authors no longer need to duplicate their styles when the preference is overridden.

Tab’s original suggestion to have `<meta name="color-scheme" content="dark">` change the reported value in the `prefers-color-scheme` feature query would circumvent that code duplication issue.

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


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

Received on Saturday, 24 August 2024 14:36:59 UTC