media-feature

inverted-colors — CSS reference

Detect whether the user agent or operating system inverts displayed colors. Values are none and inverted. Avoid blanket reinversion, which may defeat user intent; a targeted adjustment to a decorative shadow can be reasonable. Not every browser implements the feature. An unmatched query alone does not establish that inversion is absent.

Formal Syntax & Structure

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

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{--mode:default;box-shadow:1px 1px #333}@media(inverted-colors:inverted){p{--mode:inverted;box-shadow:none}}</style><body><p id="a">Inversion preference example</p></body></html>
CSS Reference