Colors

All colors are prefixed with --color-. The stylesheet defines 2 sets of colors: the standard palette and semantic colors.

Standard Palette

The stylesheet defines multiple shades for each of the following colors: brand, red, orange, yellow, green, teal, blue, purple, magenta, and gray.

There are 9 shades for each color, ranging from 1 to 9, where lower numbers have the most contrast with the page background. In other words, shade 1 is the darkest shade in light mode, but the lightest shade in dark mode. Different design systems have different numbering schemes, but a good mental model for this one is that light mode is the canonical color mode, and the number of a given color refers to its lightness.

There are also 2 transparent variants for each color: transparent and extra-transparent. These are based on shade 5, but with varying opacities.

The variables for these colors all use the standard --color- prefix, followed by the color name and shade. For example, the color red with lightness 1 is defined as --color-red-1, while red with high transparency is defined as --color-red-extra-transparent. Below is an example of how to reference these colors in a stylesheet:

CSS Copied!
.red {
  background-color: var(--color-red-1);
}

.transparent-red {
  background-color: var(--color-red-extra-transparent);
}

Below are samples of all the colors in shades 1 through 9:

1 2 3 4 5 6 7 8 9
brand
1 2 3 4 5 6 7 8 9
red
1 2 3 4 5 6 7 8 9
orange
1 2 3 4 5 6 7 8 9
yellow
1 2 3 4 5 6 7 8 9
green
1 2 3 4 5 6 7 8 9
teal
1 2 3 4 5 6 7 8 9
blue
1 2 3 4 5 6 7 8 9
purple
1 2 3 4 5 6 7 8 9
magenta
1 2 3 4 5 6 7 8 9
gray

Semantic Colors

In addition to the standard palette, the stylesheet defines a set of “semantic” colors. These colors are named after their intended use cases and do not have multiple shades.

color-surface-primary
Previously color-body-alt, color-surface . These deprecated aliases will be removed in version 1.0.
The primary background color for surfaces like cards.
color-surface-secondary
Previously color-body, color-page . These deprecated aliases will be removed in version 1.0.
A secondary background color also used for the main page background.
color-surface-tertiary
A tertiary background color for additional surface elements.
color-text-primary
Previously color-body-text . This deprecated alias will be removed in version 1.0.
The primary text color for the document.
color-text-secondary
Previously color-body-text-alt . This deprecated alias will be removed in version 1.0.
The secondary text color for the document.
color-text-tertiary
The tertiary text color for the document.
color-contrast-background
A background color that contrasts with the page background.
color-contrast-text
Previously color-body-text-invert . This deprecated alias will be removed in version 1.0.
Color for text on backgrounds that contrast with the page background.
color-shadow
A transparent gray used for shadows.
color-border
A gray used as the default color for borders.