Re: [csswg-drafts] [css-color] Add a function to allow authors to specify colors reacting to `color-scheme` (#7561)

>    However, the nesting version doesn’t beat `schemed-value()` imo, so authors would still benefit from having such a function available:
>    ```css
>    el {
>      --img: schemed-value(
>        dark url(/img/bg-dark.png),
>        other url(/img/bg-other.png),
>        url(/img/bg-light.png)
>      );
>      background: transparent var(--img) no-repeat 0 0;
>    }
>    ```

Additionally, schemed-value() can do something the media query cannot, because prefers-color-scheme matches the same across the document while  schemed-value() respond to the per-element color-scheme:

```html
<style>
  div { background-color: schemed-value(dark red, light green); }
</style>
<div style="color-scheme:light">Green background</div>
<div style="color-scheme:dark">Red background</div>
```


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


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

Received on Wednesday, 9 August 2023 11:08:34 UTC