← Back to release summary

Support currentcolor in Relative Color Syntax

Category
CSS
Type
Chromium catches up
Status
Enabled by default (Chrome 131)
Intent stage
None

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

Motivation

Relative Color Syntax was selected for Interop 2024 with a large fraction of non-passing tests covering use of currentcolor. Without this feature, web developers have to resort to sub-optimal workarounds such as passing the base color in a CSS Variable.

Standards & signals

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

View on chromestatus.com