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.
name: Example documentationpreset: enterprisecolors: 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.
Set the link colour with your primary
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:
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:
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
| Preset | Character |
|---|---|
hearth | A full preset: warm white canvas, one terracotta accent, soft rounded cards, a pill-ready control set, one soft shadow, and a generous section rhythm. |
atrium | Full preset: spacious, pill buttons and soft grey bands. |
broadsheet | Full preset: editorial, square corners and heavy rules. |
canopy | Full preset: a dark-leaning developer look in emerald. |
folio | Full preset: warm paper and calm reading. |
lattice | Full preset: a square enterprise grid. |
marigold | Full preset: playful, chunky and warm amber. |
meridian | Full preset: polished and airy with elevated cards. |
monolith | Full preset: stark monochrome with square corners. |
nocturne | Full preset: minimal, tight type and blue. |
prism | Full preset: bright, rounded and bold display type. |
enterprise | Neutral surfaces, square corners, restrained headings, quiet text hover in the header. |
neutral | Grayscale with rounded controls. |
maple | Warm amber and espresso, rounded navigation and code frames. |
light | Clean neutral surfaces with an indigo accent. |
dark | Dark default with an indigo accent. |
ocean | Blue-green palette. |
dusk | Purple twilight palette. |
emerald | Green and teal. |
purple | Violet and magenta. |
ruby | Crimson and pink. |
solar | Gold and amber. |
aspen | Earthy beige and sage. |
almond | Warm off-white. |
catppuccin | Pastel mocha palette. |
vitepress | Minimal 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.
preset: hearthEvery 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:
preset: hearthtypography: scale-display-xl-size: 4rem scale-display-xl-weight: 700spacing: section: 5remradius: card: 8px button: 9999pxelevation: raised: 0 4px 12px rgb(0 0 0 / 0.08)motion: duration-base: 200msvariants: nav: mega button: pillYou can also set any of these on a colour preset; the preset’s colours stay and the elements you set take effect.
| Section | Keys |
|---|---|
typography | scale-<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. |
spacing | xxs, xs, sm, md, base, lg, xl, xxl, section (the vertical rhythm between page bands). |
radius | button, control, card, panel, chip. |
elevation | flat, raised, overlay: CSS box-shadow values. raised is used on hovered cards, overlay on dropdowns and popovers. |
motion | duration-fast, duration-base, duration-slow, easing. |
variants | nav (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
preset: enterprisetypography: 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: 600layout: nav-height: 4rem sidebar-width: 18rem toc-width: 14rem page-max-width: 52remprose: line-height: '1.7' heading-line-height: '1.25' content-gap-y: 1.5remcode: block-radius: 0rem inline-radius: 0rem inline-padding-y: 0.1em inline-padding-x: 0.3emFont-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.
| Section | Controls and behavior |
|---|---|
typography | body, heading, and mono select font families. body-weight and heading-weight set shared text weights. |
layout | nav-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. |
prose | line-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. |
code | block-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.
| Token | Purpose |
|---|---|
--color-primary / --color-primary-content | Brand color and readable text on its fill. |
--color-accent / --color-accent-content | Secondary accent and its foreground. |
--color-base-100 / --color-base-content | Page background and body text. |
--color-base-200 / --color-base-300 | Secondary surfaces and dividers. |
--color-pl-muted / --color-pl-muted-bg | Muted text and surfaces. |
--color-pl-link | Link 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-heading | Documentation 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-fg | Documentation card surface and foreground. |
--radius-selector | Small selectors and menu items. |
--radius-field | Fields, buttons, and header controls. |
--radius-box | Cards, 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.
| Token | Purpose |
|---|---|
--publier-nav-item-radius | Sidebar row corners. |
--publier-header-hover-bg | Header hover surface. |
--publier-header-hover-opacity | Derives header hover text from the local foreground and background. |
--publier-header-hover-color | Optional explicit header hover color. |
--publier-header-active-bg | Current top-level header destination’s surface. |
--publier-control-radius | Corners on residual controls, including the theme toggle. |
--publier-surface-radius | Corners on residual overlays and callouts. |
--publier-card-radius | LinkCard corners. |
--publier-shadow-color / --publier-shadow-opacity | Tint 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:
customCss: - ./src/styles/brand.cssTarget Publier’s existing light and dark modes instead of introducing a mode that the theme toggle cannot select:
: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.