Skip to content
✨ Publier v1 is live — a polished docs platform built for the open web.
On this page

Theming

Choose a visual preset and customize colors, typography, spacing, corners, and navigation feedback.

Publier includes named visual presets for the shared marketing and documentation shell. A preset supplies colors, layout defaults, and component geometry. Select it in theme.yaml, then override your brand colors or typography. Presets share the same navigation and document structure.

Choose a preset

Set preset in theme.yaml at your project root. Publier imports the matching stylesheet automatically; you do not need to import it in another CSS file.

theme.yaml
name: Example documentation
preset: enterprise
colors:
primary: 'light-dark(#305dcc, #9bb8ff)'
primary-content: 'light-dark(#ffffff, #171717)'
accent: 'light-dark(#305dcc, #9bb8ff)'
accent-content: 'light-dark(#ffffff, #171717)'

Use a foreground that remains readable on each primary or accent fill. Overrides accept valid CSS colors, including hex, OKLCH, and light-dark(); they preserve the supplied value.

A preset’s link colour is tuned for the preset’s own primary, so overriding primary alone leaves links, the focus ring and the active sidebar item in the preset’s hue. Set link alongside it:

theme.yaml
colors:
primary: '#007D54'
primary-content: '#ffffff'
link: '#007D54'

link applies in light mode; dark mode keeps the preset’s own link colour. Link text needs 4.5:1 contrast against every surface it sits on, including tinted ones such as the active sidebar row. A bright brand colour that works as a button fill can miss that as text, so pick a darker tone of it here.

A site with its own dark palette sets the dark-mode counterparts, link-dark and heading-dark (@publier/shell 0.8.0 or later). Give every other colour both values with light-dark(), so neither mode inherits the other’s surfaces:

theme.yaml
colors:
base-100: 'light-dark(#ffffff, #0b1532)'
base-content: 'light-dark(#525666, #c3cae0)'
link: '#007D54'
link-dark: '#00B079'
heading: '#031059'
heading-dark: '#ffffff'

The bright tone that fails as link text on white often passes on a dark surface, so link-dark is usually the brand colour itself.

Built-in presets

PresetCharacter
hearthA full preset: warm white canvas, one terracotta accent, soft rounded cards, a pill-ready control set, one soft shadow, and a generous section rhythm.
atriumFull preset: spacious, pill buttons and soft grey bands.
broadsheetFull preset: editorial, square corners and heavy rules.
canopyFull preset: a dark-leaning developer look in emerald.
folioFull preset: warm paper and calm reading.
latticeFull preset: a square enterprise grid.
marigoldFull preset: playful, chunky and warm amber.
meridianFull preset: polished and airy with elevated cards.
monolithFull preset: stark monochrome with square corners.
nocturneFull preset: minimal, tight type and blue.
prismFull preset: bright, rounded and bold display type.
enterpriseNeutral surfaces, square corners, restrained headings, quiet text hover in the header.
neutralGrayscale with rounded controls.
mapleWarm amber and espresso, rounded navigation and code frames.
lightClean neutral surfaces with an indigo accent.
darkDark default with an indigo accent.
oceanBlue-green palette.
duskPurple twilight palette.
emeraldGreen and teal.
purpleViolet and magenta.
rubyCrimson and pink.
solarGold and amber.
aspenEarthy beige and sage.
almondWarm off-white.
catppuccinPastel mocha palette.
vitepressMinimal documentation palette.

The shell supports light and dark mode. Some presets, including dark, ocean, dusk, solar, and catppuccin, keep a fixed dark palette in both modes. enterprise provides distinct light and dark palettes. The data-theme="light" or data-theme="dark" attribute on <html> selects the mode; ThemeToggle manages the preference and retains it across navigation.

Enterprise styling

The enterprise preset makes fields, buttons, menus, sidebar rows, documentation cards, and callouts square. It uses a neutral light/dark palette and a heading weight of 600. Brand colors remain configurable.

Top-level header links change text color on hover without acquiring a filled pill or a visible border. Current destinations use brand-colored text. Keyboard navigation retains a visible focus outline, and disclosure arrows retain their motion and reduced-motion behavior. Menu items and sidebar rows use subtle surface feedback to help readers follow selection.

The preset applies to Publier’s shared components. Custom marketing components keep their own CSS unless you connect their styles to the same tokens.

Full presets

Full presets and the spacing, radius, elevation, motion and variants sections, along with the atrium, broadsheet, canopy, folio, lattice, marigold, meridian, monolith, nocturne and prism presets, are part of the current release.

A colour preset only changes colour. A full preset also sets a type scale, spacing, corner radius per role, elevation, motion and component variants, so one line in theme.yaml changes the whole feel of a site. hearth was the first full preset; atrium, broadsheet, canopy, folio, lattice, marigold, meridian, monolith, nocturne and prism are full presets too.

theme.yaml
preset: hearth

Every element is overridable. The cascade is: the base, then the preset, then your theme.yaml, then customCss. Set one element and keep the rest of the preset:

theme.yaml
preset: hearth
typography:
scale-display-xl-size: 4rem
scale-display-xl-weight: 700
spacing:
section: 5rem
radius:
card: 8px
button: 9999px
elevation:
raised: 0 4px 12px rgb(0 0 0 / 0.08)
motion:
duration-base: 200ms
variants:
nav: mega
button: pill

You can also set any of these on a colour preset; the preset’s colours stay and the elements you set take effect.

SectionKeys
typographyscale-<role>-<property>, where the role is display-xl, display-lg, display-md, heading-lg, heading-md, heading-sm, title, body-lg, body-md, body-sm, caption, label, button or code, and the property is size, weight, line-height or tracking.
spacingxxs, xs, sm, md, base, lg, xl, xxl, section (the vertical rhythm between page bands).
radiusbutton, control, card, panel, chip.
elevationflat, raised, overlay: CSS box-shadow values. raised is used on hovered cards, overlay on dropdowns and popovers.
motionduration-fast, duration-base, duration-slow, easing.
variantsnav (simple or mega), button (square, rounded or pill), card (hairline, elevated or filled), hero (plain or split-panel), section (framed-grid or open).

Variants switch component shapes without changing your content. The page markup is the same for every value; the shell exposes data-variant-* attributes on <html> that the shared styles and scripts read. variants.nav: mega turns the header’s grouped menus into a full-width mega menu.

Each token is also a CSS variable you can use in customCss: --publier-scale-<role>-<property>, --publier-space-<step>, --publier-radius-<role>, --publier-elevation-<tier> and --publier-motion-<token>.

Configure typography and dimensions

theme.yaml
preset: enterprise
typography:
body: 'var(--publier-font-builtin-sans), system-ui, sans-serif'
heading: 'var(--publier-font-builtin-sans), system-ui, sans-serif'
mono: 'var(--publier-font-builtin-mono), monospace'
body-weight: 400
heading-weight: 600
layout:
nav-height: 4rem
sidebar-width: 18rem
toc-width: 14rem
page-max-width: 52rem
prose:
line-height: '1.7'
heading-line-height: '1.25'
content-gap-y: 1.5rem
code:
block-radius: 0rem
inline-radius: 0rem
inline-padding-y: 0.1em
inline-padding-x: 0.3em

Font-family values select fonts; they do not download an arbitrary font. Configure font loading separately for a custom family. Publier loads Inter Variable through --publier-font-builtin-sans and JetBrains Mono through --publier-font-builtin-mono; use these tokens to retain the bundled fonts. Shared headings use typography.heading, falling back to the body family when it is omitted. Body and heading weights accept strings or numbers; the chosen font must provide the requested weight.

These controls require @publier/shell 0.1.1 or later with its matching native dependency.

SectionControls and behavior
typographybody, heading, and mono select font families. body-weight and heading-weight set shared text weights.
layoutnav-height sets the header minimum height and sticky/anchor offsets. sidebar-width and toc-width size the desktop rails; the sidebar has the same fixed width on every page (16rem unless you set one), so it never resizes when a group opens. Make it as wide as your longest sidebar label needs. page-max-width bounds documentation articles and marketing menu content.
proseline-height and heading-line-height set text rhythm. content-gap-y sets margins between direct prose blocks. Omit it to retain the default element spacing.
codeblock-radius styles plain fences and Expressive Code frames. inline-radius and inline-padding-y/inline-padding-x style inline code. Omitted padding retains the existing defaults.

Desktop rail settings retain their responsive breakpoints; labels wrap within the configured sidebar width. Mobile navigation uses a separate dialog. Header content can wrap beyond its minimum height. Expressive Code adds its frame border to the configured radius. Components marked not-prose retain their own spacing and inline-code geometry.

Understand the token layers

Publier components use DaisyUI color and radius tokens together with semantic roles for particular surfaces. Dropdowns use the base surface colors; menu hover feedback is derived from the base foreground. The table lists tokens with active consumers.

TokenPurpose
--color-primary / --color-primary-contentBrand color and readable text on its fill.
--color-accent / --color-accent-contentSecondary accent and its foreground.
--color-base-100 / --color-base-contentPage background and body text.
--color-base-200 / --color-base-300Secondary surfaces and dividers.
--color-pl-muted / --color-pl-muted-bgMuted text and surfaces.
--color-pl-linkLink and active-navigation text, the focus ring and the active sidebar item. Each preset sets a tone tuned for its own primary; set colors.link and colors.link-dark to change it.
--color-pl-headingDocumentation and prose headings. Set colors.heading (light mode) and colors.heading-dark (dark mode) in theme.yaml; unset, headings use --color-base-content.
--color-pl-card / --color-pl-card-fgDocumentation card surface and foreground.
--radius-selectorSmall selectors and menu items.
--radius-fieldFields, buttons, and header controls.
--radius-boxCards, menus, alerts, and dialogs.

Use the corresponding semantic classes where possible: btn btn-primary, alert alert-info, rounded-field, and rounded-box. Tailwind classes such as rounded-md express fixed geometry and do not follow DaisyUI radius tokens.

Structural tokens

Some shared components use Publier-specific tokens. theme.yaml exposes typography, layout, prose, and code overrides. Other structural or semantic roles can be changed through customCss.

TokenPurpose
--publier-nav-item-radiusSidebar row corners.
--publier-header-hover-bgHeader hover surface.
--publier-header-hover-opacityDerives header hover text from the local foreground and background.
--publier-header-hover-colorOptional explicit header hover color.
--publier-header-active-bgCurrent top-level header destination’s surface.
--publier-control-radiusCorners on residual controls, including the theme toggle.
--publier-surface-radiusCorners on residual overlays and callouts.
--publier-card-radiusLinkCard corners.
--publier-shadow-color / --publier-shadow-opacityTint and strength of shared elevation shadows.

Selected sidebar rows use a translucent primary tint and primary-colored text. They do not use the former solid-fill navigation tokens.

Advanced overrides

Declare a custom stylesheet in publier.config.yaml:

publier.config.yaml
customCss:
- ./src/styles/brand.css

Target Publier’s existing light and dark modes instead of introducing a mode that the theme toggle cannot select:

src/styles/brand.css
:root,
:root[data-theme="light"] {
--color-pl-card: #ffffff;
--publier-card-radius: 0.25rem;
}
:root[data-theme="dark"] {
--color-pl-card: #202020;
--publier-card-radius: 0.25rem;
}

Custom CSS follows the generated preset and theme overrides. It is not validated like theme.yaml, and normal CSS specificity and layer rules still apply. Check both modes, keyboard focus, narrow screens, and long navigation labels after changing tokens.