CSS Variables

We use several CSS variables that you can override to customize your site. You can create multiple classes that set these variables and switch between them to create multiple themes, or use the prefers-color-scheme @media query to create a dark theme.

This is a reference of all the variables you can set on the root <html> element. There are a few more that are used with specific components or utility classes; these will be listed in the documentation for that class.

§ Colors

--fg

The text color.

--muted-fg

Text color for disabled or de-emphasized elements. It's important that this color is readable against all of the background colors.

--faded-fg

De-emphasized or disabled graphical elements. Will not be used as a text color.

--info-fg

Foreground color for the .info colorway.

--ok-fg

Foreground color for the .ok colorway.

--bad-fg

Foreground color for the .bad colorway.

--warn-fg

Foreground color for the .warn colorway.

--bg

Page background.

--colorful-bg

Background for blocks: cards, admonitions etc.

--interactive-bg

Background for interactive elements

--info-bg

Background color for the .info colorway.

--ok-bg

Background color for the .ok colorway.

--bad-bg

Background color for the .bad colorway.

--warn-bg

Background color for the .warn colorway.

--shadow

Box shadows.

--accent

Accent color. It's important that this color is readable against all of the background colors.

--muted-accent

Less vivid version of accent color. Will not be used for text.

§ Lengths

--rhythm

Vertical rhythm, line height.

--line-length

Maximum line length for prose.

§ Fonts

--main-font

The main font family for text.

--secondary-font

A secondary text font. It's a good idea to specify a sans-serif font as it will be used for buttons.

--mono-font

Monospace font for code, preformatted text, computer input and output.

Tip: Browsers shrink monospace fonts. You can suppress this behavior by specifying monospace twice:

{
  --mono-font: "Cascadia Code", monospace, monospace
}

§ Density

--density

The amount of space between elements (i.e. gaps between paragraphs, padding of boxes), as a multiplier of the line height (--rhythm). See Utilities / Density.