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

Summarizing the issue, the current proposal is to allow authors to register custom color schemes through an at-rule. It requires at minimum a `base-scheme` that is used as the basis for the new scheme.

Inside the definition, all System Colors can then be specified. When one is omitted, the one from the `base-scheme` is used.

```css
@color-scheme --solarized-dark {
  base-scheme: dark;
  AccentColor: …;
  AccentColorText: …;
  …
}
```

Custom color schemes can then be used as a value in the `color-scheme` property, which was [future-proofed to accept `<custom-ident>`s](https://drafts.csswg.org/css-color-adjust/#color-scheme-prop:~:text=%3Ccustom%2Dident%3E%20values%20are%20meaningless%2C%20and%20exist%20only%20for%20future%20compatibility%2C%20so%20that%20future%20added%20color%20schemes%20do%20not%20invalidate%20the%20color%2Dscheme%20declaration%20in%20legacy%20user%20agents)

```css
html {
  color-scheme: --solarized-dark;
}
```

The [Web Preferences API](https://wicg.github.io/web-preferences-api/) would allow switching to a custom theme through a preference if multiple are defined. That would also enable the use of a custom color scheme in `prefers-color-scheme` Media Query Conditions.

The addition of custom color schemes opens up the door to [`schemed-value()`](https://github.com/w3c/csswg-drafts/issues/7561#issuecomment-1644625985) in the future.

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


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

Received on Thursday, 15 February 2024 04:15:45 UTC