8000 [css-color-6] Make color-contrast() candidates optional · Issue #7345 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-color-6] Make color-contrast() candidates optional #7345

@LeaVerou

Description

@LeaVerou

From https://www.w3.org/TR/css-color-5/#winner

If there is a target contrast, and the end of the list is reached without meeting that target, either white or black is returned, whichever has the higher contrast.

However, a lot of the time getting either black or white is exactly what you want. If this is the default behavior, people shouldn't have to do dummy things like color-contrast(var(--color) vs white, black) or even color-contrast(var(--color) vs var(--color), var(--color)) etc, they should just be able to do something like color-contrast(var(--color)) and get either white or black.

I.e. change the grammar from:

color-contrast() = color-contrast( <color> vs <color>#{2,}  [ to [<number> | AA | AA-large | AAA | AAA-large]]? )

to:

color-contrast() = color-contrast( <color> [ vs <color>#{2,}  [ to [<number> | AA | AA-large | AAA | AAA-large]]? ]? )

Metadata

Metadata

Assignees

No one assigned

    Labels

    a11y-trackerGroup bringing to attention of a11y, or tracked by the a11y Group but not needing response.css-color-6

    Type

    No type

    Projects

    Status

    Tuesday

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0