forced-color-adjust
Limited availability81% of users
Controls whether the browser is allowed to override an element's colors (like when 'High Contrast Mode' is active on Windows). It's handy for preserving specific brand colors that might otherwise be hidden.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyComingNot in Safari yet, so not every major browser supports it.
The old way and the modern waySee the snippet: Windows High Contrast support without broken UI →
Old way 7 lines
/* no border: in forced colors the background is replaced
and the button edge vanishes. Just text is left. */
.btn {
background: var(--accent);
color: white;
border: none;
}Modern 13 lines
.btn {
background: var(--accent);
color: white;
border: 1px solid transparent;
}
@media (forced-colors: active) {
.btn {
background: ButtonFace;
color: ButtonText;
border: 1px solid ButtonText;
}
}
/* High Contrast users see a real button instead of a coloured rectangle */See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
auto- Inherited
- Yes
- Applies to
- all elements and text
- Animation type
- notAnimatable
Quick example
.brand-logo {
/* Prevents Windows High Contrast mode from changing the logo colors */
forced-color-adjust: none;
}Values
autononepreserve-parent-colorforced-color-adjust browser support
BaselineLimited availabilityThis feature is not Baseline because it does not work in some of the most widely-used browsers.Not ready for production without a fallback.
Usage81%of people can use this19% use a browser without it.
Browsers
89+
113+
79+Mobile
89+Android
113+Android