{{CSSRef}}
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.
Syntax
Note that these keywords are case insensitive, but are listed here with mixed case for readability.
AccentColor
- : Background of accented user interface controls.
AccentColorText
- : Text of accented user interface controls.
ActiveText
- : Text of active links.
ButtonBorder
- : Base border color of controls.
ButtonFace
- : Background color of controls.
ButtonText
- : Text color of controls.
Canvas
- : Background of application content or documents.
CanvasText
- : Text color in application content or documents.
Field
- : Background of input fields.
FieldText
- : Text in input fields.
GrayText
- : Text color for disabled items (for example, a disabled control).
Highlight
- : Background of selected items.
HighlightText
- : Text color of selected items.
LinkText
- : Text of non-active, non-visited links.
Mark
- : Background of text that has been specially marked (such as by the HTML
mark
element).
- : Background of text that has been specially marked (such as by the HTML
MarkText
- : Text that has been specially marked (such as by the HTML
mark
element).
- : Text that has been specially marked (such as by the HTML
SelectedItem
- : Background of selected items, for example, a selected checkbox.
SelectedItemText
- : Text of selected items.
VisitedText
- : Text of visited links.
Deprecated system color keywords
The following keywords were defined in earlier versions of the CSS Color Module. They are now deprecated for use on public web pages.
ActiveBorder
{{Deprecated_Inline}}
- : Active window border. Same as
ButtonBorder
.
- : Active window border. Same as
ActiveCaption
{{Deprecated_Inline}}
- : Active window caption. Should be used with
CaptionText
as foreground color. Same asCanvas
.
- : Active window caption. Should be used with
AppWorkspace
{{Deprecated_Inline}}
- : Background color of multiple document interface. Same as
Canvas
.
- : Background color of multiple document interface. Same as
Background
{{Deprecated_Inline}}
- : Desktop background. Same as
Canvas
.
- : Desktop background. Same as
ButtonHighlight
{{Deprecated_Inline}}
- : The color of the border facing the light source for 3-D elements that appear 3-D due to that layer of surrounding border. Same as
ButtonFace
.
- : The color of the border facing the light source for 3-D elements that appear 3-D due to that layer of surrounding border. Same as
ButtonShadow
{{Deprecated_Inline}}
- : The color of the border away from the light source for 3-D elements that appear 3-D due to that layer of surrounding border. Same as
ButtonFace
.
- : The color of the border away from the light source for 3-D elements that appear 3-D due to that layer of surrounding border. Same as
CaptionText
{{Deprecated_Inline}}
- : Text in caption, size box, and scrollbar arrow box. Should be used with the
ActiveCaption
background color. Same asCanvasText
.
- : Text in caption, size box, and scrollbar arrow box. Should be used with the
InactiveBorder
{{Deprecated_Inline}}
- : Inactive window border. Same as
ButtonBorder
.
- : Inactive window border. Same as
InactiveCaption
{{Deprecated_Inline}}
- : Inactive window caption. Should be used with the
InactiveCaptionText
foreground color. Same asCanvas
.
- : Inactive window caption. Should be used with the
InactiveCaptionText
{{Deprecated_Inline}}
- : Color of text in an inactive caption. Should be used with the
InactiveCaption
background color. Same asGrayText
.
- : Color of text in an inactive caption. Should be used with the
InfoBackground
{{Deprecated_Inline}}
- : Background color for tooltip controls. Should be used with the
InfoText
foreground color. Same asCanvas
.
- : Background color for tooltip controls. Should be used with the
InfoText
{{Deprecated_Inline}}
- : Text color for tooltip controls. Should be used with the
InfoBackground
background color. Same asCanvasText
.
- : Text color for tooltip controls. Should be used with the
Menu
{{Deprecated_Inline}}
- : Menu background. Should be used with the
MenuText
or-moz-MenuBarText
foreground color. Same asCanvas
.
- : Menu background. Should be used with the
MenuText
{{Deprecated_Inline}}
- : Text in menus. Should be used with the
Menu
background color. Same asCanvasText
.
- : Text in menus. Should be used with the
Scrollbar
{{Deprecated_Inline}}
- : Background color of scroll bars. Same as
Canvas
.
- : Background color of scroll bars. Same as
ThreeDDarkShadow
{{Deprecated_Inline}}
- : The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Same as
ButtonBorder
.
- : The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Same as
ThreeDFace
{{Deprecated_Inline}}
- : The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Should be used with the
ButtonText
foreground color. Same asButtonFace
.
- : The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Should be used with the
ThreeDHighlight
{{Deprecated_Inline}}
- : The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Same as
ButtonBorder
.
- : The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Same as
ThreeDLightShadow
{{Deprecated_Inline}}
- : The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Same as
ButtonBorder
.
- : The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Same as
ThreeDShadow
{{Deprecated_Inline}}
- : The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Same as
ButtonBorder
.
- : The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Same as
Window
{{Deprecated_Inline}}
- : Window background. Should be used with the
WindowText
foreground color. Same asCanvas
.
- : Window background. Should be used with the
WindowFrame
{{Deprecated_Inline}}
- : Window frame. Same as
ButtonBorder
.
- : Window frame. Same as
WindowText
{{Deprecated_Inline}}
- : Text in windows. Should be used with the
Window
background color. Same asCanvasText
.
- : Text in windows. Should be used with the
Examples
Using system colors
In this example we have a button that normally gets its contrast using the {{cssxref("box-shadow")}}
property. In forced colors mode, box-shadow
is forced to none
, so the example uses the forced-colors
media feature to ensure there is a border of the appropriate color (ButtonBorder
in this case).
HTML
<button class="button">Press me!</button>
CSS
.button {
border: 0;
padding: 10px;
box-shadow:
-2px -2px 5px gray,
2px 2px 5px gray;
}
@media (forced-colors: active) {
.button {
/* Use a border instead, since box-shadow
is forced to 'none' in forced-colors mode */
border: 2px ButtonBorder solid;
}
}
Result
{{EmbedLiveSample("Using system colors")}}
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
<color>
: the data type these keywords belong to