System colors
The <system-color> CSS data type usually reflects the default color choices used for the different parts of a web page.
However, user agents can provide an accessibility feature called forced colors mode, in which colors are restricted into a user- and user agent-defined palette, overriding the author's choice of colors in certain properties. In forced colors mode, <system-color> exposes the chosen colors, so that the rest of the page can integrate with them. An example of forced colors mode is high contrast mode on Windows.
In forced colors mode, authors should use colors from the <system-color> type for all properties that are not in the set of properties whose colors are overridden. This ensures that the page consistently uses the same color palette across all properties.
Authors can detect forced colors mode using the forced-colors media feature.
A <system-color> value can be used anywhere a <color> can be used.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 1 | 18 | 1 | |
| CSS type | ||||||
system-color.accentcolor accentcolortext `AccentColor` and `AccentColorText` | 115 | 115 | 103 | 16.5 | 115 | 16.5 |
system-color.buttonborder `ButtonBorder` | 101 | 101 | 109 | | 101 | |
system-color.mark `Mark` | 102 | 102 | 109 | | 102 | |
system-color.marktext `MarkText` | 102 | 102 | 109 | | 102 | |
- Requires an experimental browser flag to be enabled
- Requires an experimental browser flag to be enabled
- Only supports a fallback: The native color when accent colour (in macOS' appearance panel) is set to 'multicolour'. On iOS falls back to the blue accent colour
- Requires an experimental browser flag to be enabled
- Only supports a fallback: The native color when accent colour (in macOS' appearance panel) is set to 'multicolour'. On iOS falls back to the blue accent colour
Syntax
.button {
background-color: ButtonFace;
color: ButtonText;
border-color: ButtonBorder;
} Live demo
Use cases
-
Using System colors
The <system-color> CSS data type usually reflects the default color choices used for the different parts of a web page.
Cautions
- May not be supported in older browsers.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.