property
color-scheme — CSS reference
Declares the schemes an element supports; it is inherited. The user agent uses the selected scheme for built-in surfaces such as controls and system colors. This does not automatically recolor arbitrary author styling. Declare matching author colors as well, and test native controls.
Formal Syntax & Structure
css syntaxcss
normal | [ light | dark | <custom-ident> ]+ && only?Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS color lab</title><style>body {margin:0} .sample {height:12px;background:#006050}p {padding:12px;background:white;color:black;border:2px solid currentColor} #a{color-scheme:light;color:light-dark(black,white)} #b{color-scheme:dark;background:black;color:light-dark(black,white)}
</style><body><p id="a">First color sample</p><p id="b">Second color sample</p></body></html>