Skip to content

[css-color] color-contrast() default algorithm #7361

@fantasai

Description

@fantasai

In #7356 and #7357 we're discussing adding syntax to specify specific contrast algorithm(s) to use. That leaves open the question of what algorithm is used if no contrast algorithm is specified. Options going forward:

  • A) Use the UA's “best available” algorithm, which can change over time.
  • B) Default to WCAG2.
  • C) No defaulting: the algorithm must always be explicitly specified.
  • D) Plan to default to whatever WCAG3 requires; in the meantime require it to be explicit.

As noted in multiple issues, WCAG2 has problems. It can return poorly contrasting colors in many cases, particularly in dark mode, and using it as the default entrenches the algorithm. The main benefits of using it are that it's already defined and very widely used, and allows us to return identical results in all UAs over time... at the expense of readability in the cases where it does poorly.

Defining color-contrast() to use the “best available” doesn't guarantee “interop” in the sense of always returning identical colors, but, it maximizes readability for users over time.

(Issue filed following breakout discussions between @svgeesus, @LeaVerou, @argyleink and myself)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Tuesday

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions