Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Styling

myst-theme exposes its color palette as CSS custom properties (CSS variables), so you can re-skin the entire interface from a single stylesheet without rebuilding the theme. Most elements also carry semantic CSS classes (e.g. myst-top-nav, myst-admonition-header) that you can target directly.

To explore the tokens interactively, try the Live color picker.

Applying overrides in your own site

Add the declarations you want to override to a stylesheet loaded by your site:

:root {
  --myst-color-info: #3b82f6;
  --myst-color-info-bg: #eff6ff;
  --myst-color-info-text: #2563eb;
  /* ...override only what you need */
}

.dark {
  --myst-color-info: #60a5fa;
  --myst-color-info-bg: #0f172a;
  --myst-color-info-text: #93c5fd;
}

For the full list of available variables and their default values, see theme-colors.css.

Naming conventions

Tokens follow the pattern --myst-color-{concept}-{variant}, with light values in :root and dark values redefined under .dark.[1]

A few rules of thumb:

Using tokens as Tailwind utilities

Every --myst-color-{name} token is also available as a Tailwind color named myst-{name}. Tailwind expands that into utility classes for every color-aware property — bg-, text-, border-, ring-, and more:

CSS variableTailwind colorExample utilities
--myst-color-bgmyst-bgbg-myst-bg, text-myst-bg, border-myst-bg
--myst-color-textmyst-texttext-myst-text, border-myst-text
--myst-color-bordermyst-borderborder-myst-border, ring-myst-border
--myst-color-info-bgmyst-info-bgbg-myst-info-bg, border-myst-info-bg

The full list of available color names mirrors the token names in theme-colors.css: strip the --myst-color- prefix and prepend myst-.

Adding a new token

When introducing a new semantic color, update both files:

  1. Add --myst-color-{name} (and its .dark override) to styles/theme-colors.css.

  2. Add 'myst-{name}': 'var(--myst-color-{name})' to the colors object in styles/index.js.

Known limitations

A few aspects of the UI are intentionally not themable yet:

Footnotes
  1. A few design systems used for inspiration: