Skip to content

[css-color-adjust] Allow authors to define custom color-scheme values. #9660

@bramus

Description

@bramus

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:

<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(): 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

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Wednesday morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions