Re: [csswg-drafts] [selectors][mediaqueries] :media() pseudo-class as a shortcut for one-off media queries (#6247)

Could also consider a `selector()` function in the `@when` syntax? I'm not sure if that's been discussed.

I realized the other day that style queries help work around this issue, but with an unfortunate parent/child limitation. We can do something like:

```css
@media (prefers-color-scheme: dark) {
  html { --mode: dark; }
}

.dark-mode { --mode: dark; }

/* the result of this query is based on the combined media-query/selector resolutions */
@container style(--mode: dark) {
  /* has to be a descendant of the element that sets the value 👎🏼 */
  body {
    background: black;
    color: white;
    /* the full list of colors only have to be defined in one place 👍🏼 */
  }
}
```

But it feels like a workaround, rather than a full solution. 

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


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

Received on Thursday, 22 September 2022 17:12:36 UTC