media-feature
forced-colors — CSS reference
Detect when the browser applies a restricted user-selected palette. The mode can suppress decorative shadows and certain backgrounds. Supply visible boundaries using system color roles, and do not override the user palette globally. The inactive value is none.
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}button{border:1px solid transparent;box-shadow:0 0 0 2px #333}@media(forced-colors:active){button{border-color:ButtonText}}</style><body><button id="a">Save</button></body></html>