*Contact emails* [email protected] *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: https://source.chromium.org/chromium/chromium/src/+/37ec5d082cb1df8959857653854677200fdb334c:ui/gfx/color_utils.h;l=43-51;bpv=0 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]. [1] https://github.com/mozilla-firefox/firefox/blob/main/servo/components/style/values/computed/color.rs#L104-L128 [2] https://webkit.org/blog/16929/contrast-color/ *Blink component* Blink>CSS <https://issues.chromium.org/issues?q=customfield1222907:%22Blink%3ECSS%22> *Web Feature ID* contrast-color <https://webstatus.dev/features/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 <https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>?* 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-color/animation/contrast-color-interpolation.html https://wpt.fyi/results/css/css-color/contrast-color-001.html https://wpt.fyi/results/css/css-color/contrast-color-currentcolor-inherited.html https://wpt.fyi/results/css/css-color/parsing/color-computed-contrast-color-function.html https://wpt.fyi/results/css/css-color/parsing/color-invalid-contrast-color-function.html https://wpt.fyi/results/css/css-color/parsing/color-valid-contrast-color-function.html https://wpt.fyi/results/css/css-color/parsing/contrast-color-function-calc-container.html 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 desktop 147 Shipping on Android 147 Shipping on WebView 147 *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 <https://chromestatus.com/>. -- Rune Lillesveen -- 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 [email protected]. To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACuPfeTdz0K67%2BRocOJHjABqXBLiMcUwFUMrhLrhvhGGfWGKeg%40mail.gmail.com.
