Palettes and brand colors
A theme sets the look. A palette sets the colors, and your brand settings override the parts that must match your style guide. Everything on this page goes in the theme key of docslit.json, as an inline object or in a separate theme file.
Palettes
Thirteen palettes ship with DocsLit. Each has a light and a dark set, and the swatches show each palette's accent. Any palette works with any theme.
| Palette | Description |
|---|---|
teal |
Deep teal accent on neutral greys (the classic default) |
ocean |
Blue accent on cool navy-slate surfaces |
forest |
Green accent on deep green surfaces |
slate |
Neutral zinc greys with a quiet grey accent |
violet |
Violet accent on purple-tinted surfaces |
rose |
Rose-red accent on warm pink-tinted surfaces |
amber |
Amber accent on warm sand surfaces |
graphite |
Pure black and white, near-monochrome |
mint |
Fresh emerald on soft green-tinted neutrals (Peppermint signature) |
ink |
Monochrome zinc surfaces with a single green accent (Frond signature) |
paper |
Warm paper and ink with a terracotta accent (Folio signature) |
steel |
Cool slate neutrals with an indigo accent (Ledger signature) |
iris |
Violet generated from a seed colour with tonal surfaces (Tonal signature) |
Use a palette on its own to keep the classic look and change only the colors:
Use it with a theme to get a different look in your colors:
slate, graphite and ink are quiet, so your brand accent carries the page. Pick one as the base and override only accent.Brand colors
Override any color in colors, which applies to both modes, or in dark and light, which apply to one:
Keys accept camelCase (accentLight) or kebab-case (accent-light).
| Color | Used for |
|---|---|
accent |
Primary brand color: active navigation, buttons, focus rings |
accentLight |
Link and hover color (lighter in dark mode, darker in light mode) |
accentDim, accentDim2 |
Translucent accent for subtle backgrounds |
onAccent |
Text on filled accent surfaces such as buttons |
bg |
Page background |
surface, surface2, surface3 |
Cards and panels, inputs and chips, hover states |
border, border2 |
Default and stronger borders |
text, text2, text3 |
Primary, secondary and muted text |
sidebarBg |
Sidebar background |
codeBg, codeText |
Code block background and text |
When you set only accent, DocsLit derives accentLight, accentDim, accentDim2, onAccent, the muted text colors and the code text colors for you, and repairs them to meet WCAG 2.2 AA contrast. Colors you set yourself are used exactly as written, and docslit validate warns with theme-low-contrast if one fails AA. See Accessibility.
With the tonal theme, the accent is the seed for the whole site: surfaces and neutrals are derived from it.
Fonts and shape
folio, which uses a serif.6px.DocsLit does not download custom fonts. Load yours with your own css file or a head tag, as described in Site chrome, and name them in the stack.
Corner radius scale
radius scales every corner in the theme at once. It is a separate key from fonts.radius:
Allowed values are none, sm, md, lg, xl, full, or a length such as "6px". Use none for a sharp look and full for pill shapes.
Light and dark appearance
By default readers see their system preference and can switch with the toggle in the header. Their choice is saved in the browser's localStorage under docslit-theme and persists across visits.
appearancesets the mode first-time visitors see:system,lightordark. A reader's own choice still wins.strict: truehides the toggle and always usesappearance.
The five newer themes follow the operating system by default. The classic default theme keeps its original behavior, dark unless the reader chose light, until you set appearance explicitly. Set "appearance": "system" to make it follow the operating system.
Pin a component to a mode
Any component with a theme attribute can ignore the page mode:
Use it to show both appearances side by side. See Code blocks for code-specific theme controls.
Theme files
A theme file is a JSON file you can version, share across projects and hand to a design team. It takes the same keys as the inline object.
docslit theme init writes brand-theme.json (or the path you give) and, when no theme is configured yet, adds "theme": "./brand-theme.json" to docslit.json.
peppermint, tonal and so on) to layer your settings on that theme. Any other string is a free brand label, and then you name the theme with theme.name is a brand label such as "Acme Brand".extends and preset.sans, heading, mono, radius and radiusLg.none, sm, md, lg, xl, full or a length.system, light or dark.appearance.name or the file name.Reference the file from docslit.json:
The dev server reloads when you edit the theme file or docslit.json.
Check your theme
docslit validate checks the whole theme configuration and gives each problem a stable code, with the nearest valid name for a typo:
| Code | Meaning |
|---|---|
theme-unknown, theme-unknown-theme, theme-unknown-palette, theme-unknown-preset |
A theme, palette or preset name is not recognised. The message suggests the nearest name. |
theme-name-typo |
A name looks like a mistyped theme id (warning). |
theme-appearance-invalid, theme-strict-invalid, theme-radius-invalid |
A value is not one of the allowed ones. |
theme-low-contrast |
One of your explicit colors fails WCAG AA (warning). |
theme-file-missing, theme-file-invalid |
A theme file path or JSON is wrong. |
theme-invalid-value, theme-invalid-type |
A key has the wrong type or an unusable value. |
Next steps
- Browse every CSS variable in the design tokens reference
- Add your logo in light and dark variants
- Return to the theme overview