Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Units and Values

System colors

Reference for CSS system color keywords such as Canvas, CanvasText, ButtonFace, Highlight and AccentColor, and how they follow color-scheme and the user's settings.

System colors are keywords whose value is chosen by the browser or the operating system rather than by you. Canvas is the page background, CanvasText is the default text, ButtonFace is the face of a button, and Highlight is the background of selected text. Because they follow the user's environment, they respect the color-scheme property and also forced-colors (high contrast) modes.

They matter most when you want parts of your design to match the platform, or when you need colors that stay legible in high-contrast mode.

CSS
.panel {
  background: Canvas;
  color: CanvasText;
  border: 1px solid ButtonBorder;
  accent-color: AccentColor;
}

Try it

System colors in light and dark

Syntax

CSS
<system-color> = AccentColor | AccentColorText | ActiveText | ButtonBorder | ButtonFace
               | ButtonText | Canvas | CanvasText | Field | FieldText | GrayText
               | Highlight | HighlightText | LinkText | Mark | MarkText
               | SelectedItem | SelectedItemText | VisitedText

Values

Keyword Meaning
Canvas / CanvasText Page background / normal text.
LinkText, VisitedText, ActiveText Link colors: unvisited, visited, being activated.
ButtonFace, ButtonText, ButtonBorder Button background, label and border.
Field, FieldText Text input background and text.
Highlight, HighlightText Selected text background and foreground.
SelectedItem, SelectedItemText Selected list items or options.
Mark, MarkText The default <mark> highlight.
GrayText Disabled or secondary text.
AccentColor, AccentColorText The user's accent color and a readable text color on it.

Usage notes

  • They are case-insensitive, but written in PascalCase by convention.
  • Pair them with color-scheme. Setting color-scheme: light dark on :root makes Canvas and CanvasText switch with the user's theme without a media query.
  • Use matched pairs. Canvas goes with CanvasText, Highlight with HighlightText. Mixing across pairs can give unreadable text.
  • Forced colors. In Windows High Contrast and similar modes, the browser replaces many author colors with system colors. Using system colors in your own rules keeps custom components visible.
  • Values vary by device. Never rely on the exact color; it can differ across browsers, operating systems and themes.
  • Older names. Window, WindowText and several others are deprecated aliases kept for old pages. Prefer the names above.

Browser support

The classic system colors have long worked across browsers. AccentColor and AccentColorText and some newer keywords arrived later, so check a compatibility table before depending on them.