← Back to release summary

CSS Color Adjust: 'only' keyword for color-scheme

Category
CSS
Type
No developer-visible change
Status
Enabled by default (Chrome 98)
Intent stage
Shipped

WPT details: Changes made to tests under https://wpt.fyi/results/css/css-color-adjust/parsing to account for spec changes for 'only'. Web platform tests do not support running with color-scheme overrides. A couple of Blink-specific rendering tests have been added to run under virtual/dark-mode-*

Summary

The 'only' keyword has been re-added to the specification for color-scheme as a way of per-element opt-out of color-scheme override like forced darkening. div { color-scheme: light } will force the div element into color-scheme dark and apply forced darkening. div { color-scheme: only light } will keep the color-scheme for the element light and opt-out of forced darkening.

Motivation

This feature can be used to do per element opt-out of color-scheme overrides like forced darkening.

Standards & signals

Ecosystem

View on chromestatus.com