Skip to content

contrast-ratio() #7730

@svgeesus

Description

@svgeesus

Motivation

For a single stylesheet which is all light-mode, has no color changes between mobile and desktop, and take no account of things like per-user customization or forced color mode, there is no need for color-contrast() because it is a static, constant expression that returns a constant result.

Once we have dark mode and light mode; once there are multiple stylesheets from different authors being combined in varying ways; once CSS variables are being extensively used - then the value of a dynamic unction like color-contrast() becomes more evident. This explains why web developers at CSS conferences, for example, have been so enthusiastic about it.

However, significant work is needed, as the simple luminance contrast function from WCAG 2.1 has significant issues with predictive accuracy. In the past, where static colors were chosen by eye and WCAG compliance run on that set just to verify, this was less of an issue. With developers relying on automatic selection because the number of combinations is not known ahead of time, the importance of a good algorithm for predicting the readability and legibility of text is greatly increased.

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