Customize
Everything visual is a CSS variable, so most changes are one line.
Colours
Override any of these on :root, or on a single element to recolour just that part of the page.
| Variable | Default |
|---|---|
--gl-base | |
--gl-surface | |
--gl-content | |
--gl-muted | |
--gl-border | |
--gl-primary | |
--gl-secondary | |
--gl-success | |
--gl-warning | |
--gl-danger | |
--gl-on-accent |
:root {
--gl-primary: #e8b45a; /* gold */
--gl-secondary: #2f9aa0; /* teal */
}Light and dark
Glimmer is dark by default. Add data-theme="light" for glass over a light page, or data-theme="auto" to follow the visitor's system setting. It works on <html> or on any element, so one section can differ from the rest. Try the Light switch in the navbar.
<html data-theme="auto">| Variable | Light value |
|---|---|
--gl-base | |
--gl-surface | |
--gl-content | |
--gl-muted | |
--gl-border |
One component, one colour
Each coloured component reads its colour from --c. Set it inline for a one-off that the five suffixes don't cover.
<span class="badge" style="--c: #c58cff">Beta</span>Corners
Three sizes: --gl-radius-sm (6px), --gl-radius-md (10px) and --gl-radius-lg (14px).
Frost
Set how frosted the glass is with frost-1 to frost-5, on <html> for everything or on one surface. Try the slider in the navbar, or see Frost.
<html class="frost-2">Fonts
Text uses --gl-font and labels use --gl-mono. Point them at any font you have loaded. The kit's own fonts are an optional import; see Install.
:root {
--gl-font: "Inter", system-ui, sans-serif;
--gl-mono: "JetBrains Mono", ui-monospace, monospace;
}Changing the source
If you work on Glimmer itself, the defaults live in tokens.json. The build regenerates the CSS variables and the Swift constants together, so the web and Apple kits never drift apart, and then the prefixed and Tailwind builds of the CSS.
npm run build