Intent to Ship: CSS contrast-color()

68 views
Skip to first unread message

Rune Lillesveen

unread,
8:51 AM (4 hours ago) 8:51 AM
to blink-dev
Contact emails
fut...@chromium.org

Specification
https://drafts.csswg.org/css-color-5/#contrast-color

Summary
This function is used to meet contrast requirements for accessibility. The contrast-color() function can be used anywhere in CSS where a color value is expected. It takes a color value argument, and returns either 'black' or 'white' depending on which of them gives the highest contrast against the color argument.

The contrast algorithm is UA-defined per spec.

Blink's implementation uses an existing WCAG-based implementation:

This is the same as the Firefox implementation[1] and Safari which have a detailed description about the WCAG algorithm and its shortcomings in their blog post[2].


Blink component
Blink>CSS

Web Feature ID
contrast-color

Motivation
This feature will make it easier for authors to meet contrast requirements for accessibility. The feature is already shipped in the two other major engines. contrast-color() is also part of Interop 2026.

Initial public proposal
No information provided

TAG review
No information provided

TAG review status
Not applicable

Risks


Interoperability and Compatibility
No information provided

Gecko: Shipped/Shipping (https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/contrast-color#browser_compatibility)

WebKit: Shipped/Shipping (https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/contrast-color#browser_compatibility)

Web developers: No signals

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

No information provided


Debuggability
No information provided

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?
Yes

Is this feature fully tested by web-platform-tests?
Yes, but given that the contrast algorithm is UA-defined per spec, most expectations allow both white and black as the returned contrast-color().
https://wpt.fyi/results/css/css-images/color-stop-contrast-color-currentcolor-invalidation.html

Flag name on about://flags
No information provided

Finch feature name
No information provided

Non-finch justification
No information provided

Rollout plan
Will ship enabled for all users

Requires code in //chrome?
False

Tracking bug
https://crbug.com/40142548

Estimated milestones
Shipping on desktop147
Shipping on Android147
Shipping on WebView147


Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

No information provided

Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/4841046007742464?gate=6582039723769856

Links to previous Intent discussions
Intent to Prototype: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACuPfeTv1YNDgDkc5SiCDwDf0ZCn0sWd7qdfUzuQvejpEut8tA%40mail.gmail.com


This intent message was generated by Chrome Platform Status.

--
Rune Lillesveen

Mike Taylor

unread,
9:26 AM (4 hours ago) 9:26 AM
to Rune Lillesveen, blink-dev

LGTM1 - thanks for catching us up here.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACuPfeTdz0K67%2BRocOJHjABqXBLiMcUwFUMrhLrhvhGGfWGKeg%40mail.gmail.com.

Vladimir Levin

unread,
9:43 AM (3 hours ago) 9:43 AM
to Mike Taylor, Rune Lillesveen, blink-dev

Chris Harrelson

unread,
9:56 AM (3 hours ago) 9:56 AM
to Vladimir Levin, Mike Taylor, Rune Lillesveen, blink-dev
Reply all
Reply to author
Forward
0 new messages