concept

forced-colors-mode — CSS reference

In forced colors mode the browser adjusts selected paint values to a limited palette associated with user settings. This is not simply a dark theme. CSS color roles can help preserve relationships. Gradients and shadows may disappear, so keep meaningful text and borders, and inspect controls in the mode rather than relying on decorative effects.

Formal Syntax & Structure

css syntaxcss
@media (forced-colors: active) { … }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS accessible theme lab</title><style>body {margin:0} .sample {height:12px;background:#006050}p{color:#b00020;background:linear-gradient(white,#ddd);text-shadow:1px 1px #aaa;border:2px solid currentColor}</style><body><p id="a">Status: payment pending</p></body></html>
CSS Reference