Skip to content

[css-color-6] Behavior of color-contrast() when no level is specified  #7556

@LeaVerou

Description

@LeaVerou

Right now, if no level is specified, the behavior is that "the most contrasting color" is returned.
This essentially ignores the preference order the candidates are listed in and is vastly different from the behavior when a level is specified, breaking consistency. E.g. it makes color-contrast(over teal, white, black) the same as color-contrast(over teal, black, white).
What are the use cases where authors want the most contrasting color? Why not default to a reasonable (or even highest) level?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions