Windows high contrast mode: why buttons vanish in forced colors, and the CSS that brings them back


Windows high contrast mode, the contrast themes that people with low vision turn on, sometimes erases a website's buttons. CSS calls it forced colors: the browser keeps text and borders in the chosen palette, drops shadows and repaints every background. A button drawn only by its fill color then melts into the page. A transparent border gives it its shape back.
See the mode, then bring each button back
#What is forced colors mode, and what does it do to buttons?
In forced colors mode, the browser keeps a button's text and border, erases its shadow and repaints its background. On Windows, the mode applies the few colors of the chosen contrast theme to every page.
It helps people with low vision, who have trouble reading low-contrast text. In 2018, 51.4% of the people with low vision surveyed by the accessibility organization WebAIM said they used some kind of high contrast mode. The WCAG criteria that the European standard EN 301 549 adopts check the contrast of the site's own colors. In forced colors mode, though, the person's colors replace the site's.
#What does the browser keep, and what does it remove?
Per the CSS Color Adjust specification, whatever is drawn with the text color or a border color stays, repainted in a theme color. Whatever depends on a shadow or a background alone loses its shape.
| What the CSS draws | What happens to it |
|---|---|
| Text, border and outline color | A theme color |
| Background color | Repainted, and transparent if it was transparent |
box-shadow, text-shadow | Removed |
Gradient (background-image without url()) | Removed; an image in url() stays |
| Color hard-coded in an SVG | Kept; currentColor follows the theme |
#Which buttons disappear on the demo page?
Take the “Book a tour” page of Tendril Hill Winery. We opened it in Chrome, which can imitate (emulate) forced colors, with the dark palette: white text on black, yellow links.

Two of the four buttons lose what made them stand out:
- “See our wines” keeps its shape: its 1 px claret border turns white.
- “Book now” shrinks to a word: its claret background turns black like the page, and its shadow is gone.
- The selected 2 PM slot looks like the other two, since only its fill set it apart.
- The white “Add to favorites” heart stays visible on its button, now black.
The most eye-catching button fades first, while the plainest holds on thanks to a 1 px line.
#How do you test high contrast mode, even on a Mac?
The most faithful test is still a real Windows contrast theme. Without Windows, even on a Mac, Chrome and Edge emulate the mode and Firefox turns it on. Safari never shows it, since Apple's systems have no forced colors mode.
On Windows 11, the setting is under Settings > Accessibility > Contrast themes. Pick a theme (Aquatic, Desert, Dusk or Night sky), then select Apply. The Left Alt+Left Shift+Print Screen shortcut turns high contrast on or off.
#How do you emulate it in Chrome or Edge?
- Open DevTools (the browser's developer tools), then its Command Menu, with Cmd+Shift+P on a Mac or Ctrl+Shift+P on Windows.
- Type “forced-colors” and run “Emulate CSS forced-colors: active”.
Edge has the same emulation, which Microsoft documents in its Rendering tool.
#How do you see it on a Mac, with Firefox?
Firefox turns on the real mode, with a palette you choose:
- In Firefox Settings, open the General panel and find the “Contrast Control” section.
- Choose the “Custom” option.
- Click “Manage Colors…” and set the text, background and link colors.
On our Mac, that option turns on forced colors. The “Increase contrast” setting in macOS doesn't trigger the mode on its own, which rules it out as a test.
#Which palette does Chrome's emulation show?
In our tests, Chrome's emulated palette follows the light or dark scheme the browser reports to the page (prefers-color-scheme). With no other setting, the Mac's appearance decides. Chrome's documentation says nothing about it. Our Mac uses the dark appearance, so the emulation first showed the white “Add to favorites” heart on a black button, at 21:1, the maximum contrast. Switching to the light scheme (prefers-color-scheme: light) made it disappear: white on a button that had turned white, 1:1, no contrast.
Marker 1. The white heart, visible on the dark palette. Marker 2. Where the heart should be, empty on the light palette.The heart's SVG keeps its own white (fill="#FFFFFF"), as the CSS specification intends. Under Chrome's light palette, three of the four buttons lose what made them stand out: “Book now”, the selected slot and the heart.
That palette is far from rare. In 2018, 25.6% of the high contrast users with low vision in WebAIM's survey had set their text dark and their background light. Every page therefore needs two tests. In the Command Menu, also run “Emulate CSS prefers-color-scheme: dark”, then repeat the test with light.
Marker 1. The “Emulate CSS media feature forced-colors” list, set to forced-colors: active. Marker 2. The “Emulate CSS media feature prefers-color-scheme” list, set to prefers-color-scheme: dark.#What CSS brings a button back in forced colors without changing the design?
Three small changes bring the buttons back: a transparent border, the text color for the icon, and, for the selected slot, a CSS block that only applies in forced colors. The “See our wines” button needs nothing. Mozilla's MDN advises using that block only for small tweaks.
#How do you give a filled button its shape back?
Give the button a 2 px transparent border, and take 2 px off its inner spacing (padding) so it keeps its size. In the usual colors, the border is invisible. In forced colors, the browser paints it in a theme color. A WCAG technique also recommends a transparent outline when the focus indicator is drawn with a shadow alone. That indicator is the frame showing keyboard users where they are.
Avoid
Marker 1. The “Book now” button, with no outline..book {
padding: 14px 32px;
background: #6B1D2A;
border: none;
box-shadow: 0 3px 0 #4A111C, 0 8px 18px rgba(74, 17, 28, .28);
}Correct
Marker 1. The “Book now” button, inside a white outline..book {
padding: 12px 30px;
background: #6B1D2A;
border: 2px solid transparent;
box-shadow: 0 3px 0 #4A111C, 0 8px 18px rgba(74, 17, 28, .28);
}On the demo, “Book now” gets a white outline on the dark palette, a black one on the light. For a focus indicator built with box-shadow, see our guide to visible focus in CSS.
#How do you keep an SVG icon visible in every theme?
Write fill="currentColor" on the icon's shape (its path), and it takes the button's text color, color: #FFFFFF in the usual colors. In forced colors, currentColor follows the theme: the heart turns white on the dark palette and black on the light one.
Avoid
Marker 1. Where the heart should be, empty.<button class="favorite" type="button" aria-label="Add to favorites">
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true">
<path fill="#FFFFFF" d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
</svg>
</button>Correct
Marker 1. The heart, now black.<button class="favorite" type="button" aria-label="Add to favorites">
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true">
<path fill="currentColor" d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
</svg>
</button>#How do you show the selected slot with @media (forced-colors: active)?
Inside @media (forced-colors: active), give the selected slot a Highlight background and HighlightText text. Both are system colors: the browser takes them from the person's theme, and the pair is meant to be read one on the other.
In our Chrome test, those two lines fall short: the slot fills with cyan and “2 PM” disappears. Chrome paints a backplate, a patch in the page color, under the text to keep it readable. The CSS specification allows it. In both Chrome palettes, HighlightText is that same color, so “2 PM” melts into the backplate. The forced-color-adjust: none property removes the backplate. The browser then stops forcing the slot's colors, so set its border and focus outline too.
Avoid
Marker 1. The 2 PM slot, identical to the others..slot input:checked + label {
color: #FFFFFF;
background: #6B1D2A;
}Correct
Marker 1. The 2 PM slot, filled with cyan..slot input:checked + label {
color: #FFFFFF;
background: #6B1D2A;
}
@media (forced-colors: active) {
.slot input:checked + label {
forced-color-adjust: none;
color: HighlightText;
background: Highlight;
border-color: Highlight;
outline-color: CanvasText;
}
}#When should you use forced-color-adjust: none?
The none value fits when every color in the rule comes from the person's theme, as with the selected slot. The specification reserves it for developers who adjust the colors to the person's needs themselves. That rules out using it to keep “Book now” claret. Version 4.1.1 of the European standard EN 301 549 also limits it to cases where the page's information or function can't work without it.
After seven CSS properties and one HTML attribute, the Tendril Hill page shows all four buttons on both palettes. On the light one, the person who picked 2 PM sees their slot filled with navy blue. In the usual colors, the fix melts into the page. On our screenshots, 32 pixels out of 1.6 million differ, all in the smoothing of the rounded corners of “Book now”.
Focus visible: how to style the focus indicator in CSS


