Intent to Ship: Support currentcolor in Relative Color Syntax

218 views
Skip to first unread message

Kevin Babbitt

unread,
Sep 19, 2024, 2:40:20 PMSep 19
to blin...@chromium.org

Contact emails

kbab...@microsoft.com

Explainer

None

Specification

https://www.w3.org/TR/css-color-5/#resolving-rcs

Design docs
https://docs.google.com/document/d/1568wVjrIRbrU9_O37gPu10cj0CDWRiAc6ZMk9t0JpXs/edit

Summary

Allow relative colors in CSS (using the 'from' keyword) to use 'currentcolor' as a base. This will make it easy for web developers to set complementary colors, based on an element's text color, for that element's borders, shadows, backgrounds, etc.

 

This feature also includes use cases where color functions are nested with a dependency on 'currentcolor', for example `color-mix(in srgb, rgb(from currentcolor r g b), white))` or `rgb(from rgb(from currentcolor 1 g b) b g r)`.

Blink component

Blink>CSS

TAG review

https://github.com/w3ctag/design-reviews/issues/894

TAG review status

Issues addressed
The link above is for Relative Color Syntax in general. Tests for 'currentcolor' cases were added as part of the discussion before the TAG signed off on the review. I discussed with Alex Russell, and he supports my interpretation that the TAG is satisfied with this use case.

 

Risks



Interoperability and Compatibility

Interoperability: Relative Color Syntax is a focus area for Interop 2024, and inclusion of 'currentcolor' is well covered by existing WPTs, so the risk of other engines not converging on an interoperable implementation is low.

 

Compatibility: The only risk here is that enabling 'currentcolor' support will "light up" color declarations that are being rejected at present. Total usage of Relative Color Syntax on the Web (including 'currentcolor' or otherwise) is ~0.15% of page loads as of September 1, 2024[1]. I haven't done an analysis of 'currentcolor' in RCS, but given that no major engine supported it until May of this year, I would expect it to be a tiny fraction of those.

[1] https://chromestatus.com/metrics/feature/timeline/popularity/4632



Gecko: Positive (https://github.com/mozilla/standards-positions/issues/841) Implementation bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1893966

WebKit: Shipped/Shipping (https://bugs.webkit.org/show_bug.cgi?id=245970) Changes landed May 13.

Web developers: Positive (https://github.com/web-platform-tests/interop/issues/426) This feature is part of Interop 2024.

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?

Low risk. This feature is additive in nature and potential for app impact is cosmetic only.



Debuggability

Covered by existing DevTools support for debugging CSS properties. Property text displays correctly in the Styles and Computed panes. I did identify one minor issue with color swatches in the Styles pane, but that's now fixed:

 https://issues.chromium.org/issues/367154236



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

https://wpt.fyi/results/css/css-color?label=master&label=experimental&aligned&view=interop&q=label%3Ainterop-2024-relative-color

 

There are a few subtest failures that remain with this feature in status=experimental, but those are cases for relative colors *not* based on 'currentcolor' and are being tracked separately.

Flag name on chrome://flags

None

Finch feature name

CSSRelativeColorSupportsCurrentcolor

Requires code in //chrome?

False

Tracking bug

https://issues.chromium.org/issues/325309578

Estimated milestones

Shipping on desktop

131

Shipping on Android

131

Shipping on WebView

131



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).

There are several ongoing discussions in the CSSWG related to colors, mostly around serialization of values. However, I did not find any open issues that were specific to 'currentcolor' support in relative colors - what I found were instead questions that apply more broadly and thus would need to be considered independently from this feature.

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/4755025804132352?gate=6199731202818048

Links to previous Intent discussions

Intent to Prototype: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/PH0PR00MB11527917FE827C65D0277F0EC0A52%40PH0PR00MB1152.namprd00.prod.outlook.com

This intent message was generated by Chrome Platform Status.

 

Alex Russell

unread,
Sep 19, 2024, 2:54:25 PMSep 19
to Kevin Babbitt, blin...@chromium.org
LGTM1

--
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 on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/PH0PR00MB1152AC9D2DCC898FD587494FC0632%40PH0PR00MB1152.namprd00.prod.outlook.com.

Mike Taylor

unread,
Sep 22, 2024, 1:35:20 PMSep 22
to Alex Russell, Kevin Babbitt, blin...@chromium.org

LGTM2 - thanks for working on this!

Chris Harrelson

unread,
Sep 22, 2024, 2:41:22 PMSep 22
to Mike Taylor, Alex Russell, Kevin Babbitt, blin...@chromium.org
Reply all
Reply to author
Forward
0 new messages