Intent to prototype & ship: CSS contrast-color() function

65 views
Skip to first unread message

Jonathan Kew

unread,
Oct 27, 2025, 5:36:02 AM (4 days ago) Oct 27
to dev-pl...@mozilla.org
As of Firefox 146, I intend to turn on support for the CSS
contrast-color() function on all platforms.

Summary: The contrast-color() CSS function picks a color that has
guaranteed contrast against a specified foreground or background color.
A typical use could be to ensure visibility of text over a background
color that varies depending on a user's chosen theme, without having to
explicitly specify an appropriate text color for every background option.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1682439

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

Standards Body: CSS Working Group

Platform coverage: All

Preference: layout.css.contrast-color.enabled

DevTools bug: n/a

Link to standards-positions discussion: n/a

Other browsers:
  Blink: some work in https://issues.chromium.org/issues/40142548,
looks currently incomplete
  WebKit: shipped (Safari 26)

web-platform-tests:
  Existing tests:
https://wpt.fyi/results/css/css-color?label=master&label=experimental&aligned&q=contrast-color
  Additional rendering test to be added alongside the Gecko
implementation in bug 1682439


- JK

Nicolas Chevobbe

unread,
Oct 27, 2025, 5:55:54 AM (4 days ago) Oct 27
to dev-pl...@mozilla.org, jfkt...@gmail.com
Thanks for sending this Jonathan.
I filed a bug for DevTools support as this might break a few things, and we could provide some debugging capability to users: https://bugzilla.mozilla.org/show_bug.cgi?id=1996533 
Reply all
Reply to author
Forward
0 new messages