Tokens
All design tokens are defined as CSS Custom Properties (also known as CSS Variables
). You should reference these properties when creating custom styles.
This page talks through each type of token and shows examples of what each value looks like.
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 the following set of base
colors: brand
, red
, orange
, yellow
, green
, sky
, blue
, purple
, magenta
, andgray
.
For each of the base colors, there are 9 lightnesses and 2 transparent
shades. The lightensses go from 1 to 9, where 1 has the most contrast with
the page background (i.e., the darkest shade in light mode and the lightest
shade in dark mode) and 9 has the least. The transparent shades are based on
lightness 5, with transparent
having a medium transparency and extra-transparent
having a high transparency.
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:
.red {
background-color: var(--color-red-1);
}
.transparent-red {
background-color: var(--color-red-extra-transparent);
}
Semantic Colors
In addition to the standard palette, the stylesheet defines a set of
semantic
colors. These colors are used for specific purposes and are named
after their use case.
Unline standard palette colors, these don't come in multiple shades.
Shadows
Font Sizes
The variables for font sizes are all prefixed with --font-size-
. For example, the font size m
can be referenced as --font-size-m
.
Font Weights
The variables for font weights are all prefixed with --font-weight-
. For example, the font weight normal
can be referenced as --font-weight-normal
.
This text has a weight of light.
This text has a weight of normal.
This text has a weight of semibold.
This text has a weight of bold.
This text has a weight of black.
Font Families
The variables for font families are all prefixed with --font-family-
. For example, the font family body
can be referenced as --font-family-body
.
This text has a font family of body.
This text has a font family of heading.
This text has a font family of mono.
Spacing
Spacing tokens scale with the screen width, becoming slightly more spread
out as the screen widens. The variables for spacing are prefixed with --space-
and are implemented as T-shirt sizes between 3xs and 3xl.
There's also a token called space-body
that scales from xs
on small screens to m
on large screens. This token is used for
the margins around the app.