v131 ยท css
Support currentcolor in Relative Color Syntax
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.
concepts
-
currentcolor in RCS
Relative color syntax accepts currentcolor as the base. Lets components derive variants from the inherited text color.
-
Component palette switcher
One card markup re-theming every part (border, badge fg/bg, body, divider) from a single inherited
color. -
Dark-mode reskin
Four themes (light, dark, sepia, high-contrast) โ every shade on the cards (border, divider, pill) is derived from a single
color. -
Hover/active/disabled state shades
A button derives every interactive state from one brand colour via
oklch(from currentcolor ...). Pick a brand colour and try the states. -
Gradients from currentcolor
Three brand cards whose gradient backgrounds, borders, and shadows are all derived from a single
colorviaoklch(from currentcolor l c h). A color picker updates the entire palette instantly. -
Link State Palette
All five link states (normal, visited, hover, active, focus) derive their colors from a single brand
colorvia relative color syntax. Pick a hue to shift the whole palette.
why it shipped
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.