[csswg-drafts] [css-color-adjust] Allow authors do define custom `color-scheme` values. (#9660)

bramus has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-adjust] Allow authors do define custom `color-scheme` values. ==
In #7561 we resolved on adding `light-dark()` so that authors can easily use a color based on whether the `light` or `dark` color scheme is being used. Authors are generally in favor of this addition but some of the feedback I got is asking **why is this limited to light and dark only**?

Reason for this, is that this is the current reality we live in: the possible values for `color-scheme` today are only `light` or `dark` (or `normal`). `<custom-ident>`s are allowed as values but these are ignored, as [per spec](https://drafts.csswg.org/css-color-adjust/#color-scheme-prop):

> `<custom-ident>` values are meaningless, and exist only for future compatibility, so that future added color schemes do not invalidate the `color-scheme` declaration in legacy user agents. User agents must not interpret any `<custom-ident>` values as having a meaning; any additional recognized color schemes must be explicitly added to this property’s grammar.

_(Hereby a thank you to the person who suggested to put that in; very future friendly!)_

Looking at #7561, `light-dark()` isn’t the end goal of that feature. The end goal is [something like `schemed-value()`](https://github.com/w3c/csswg-drafts/issues/7561#issuecomment-1644625985): allow authors to get a value based on a passed in `color-scheme` – any `color-scheme`.

To unblock that issue forward, a first step would be to allow authors to define custom `color-scheme` values. These defined values could then then be used in side `color-scheme` and the `prefers-color-scheme` Media Feature.

---

Classic use-cases are coding color schemes, or application theming such as Slack or VS Code offer:

![image](https://github.com/w3c/csswg-drafts/assets/213073/56ab5123-d6e7-4f8a-8a7e-0b9f211eb66b)

![image](https://github.com/w3c/csswg-drafts/assets/213073/5d8339c0-7683-4d63-8996-b1295e077dd7)



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9660 using your GitHub account


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

Received on Thursday, 30 November 2023 14:19:22 UTC