Skip to content

Constitution themes

A constitution can give its Shuttle channel a visual identity without changing its documents or the Desk. Its theme reaches the reader's veil, thumbnail paper, page frames, label bars, fiber header and prose, Markdown or text pages, and audio waveform ink. Phone top and bottom bars use the channel's materials without adding a card frame around the edge-to-edge page. HTML reports, PDFs, images and other documents keep their own styling. The board's bar, with the reader's map of pages, stays the Desk's on every view.

Declaration

Pick a bundled theme in the fiber's frontmatter:

theme: blueprint

The bundled names are portolan (the default), blueprint, laboratory-paper, and night-chart. Names are case-insensitive; spaces can stand in for hyphens. An unknown name uses Portolan and warns in the browser console. The reference CSS files live in ui/src/board/workspace/themes/.

A sibling theme.css, beside the fiber's Markdown and tapestry.html, layers on top of that bundled base. You can supply either declaration, or both. Shuttle fetches the stylesheet from the fiber's owning daemon through the same owner-routed file API as documents. It caches by ETag and checks for edits on the workspace's ordinary refresh cadence (at most once every 15 seconds while the channel is drawn). Missing, unreachable or unparseable CSS leaves the bundled base in place; it never prevents reading. CSS uses the browser's error recovery: malformed individual declarations are ignored, and a nonempty file with no valid rules is rejected.

The page's ⋯ menu includes Plain (drop this constitution's theme) when the constitution declares a theme or has a sibling theme.css. Its check state shows whether Plain is selected. It removes both the bundled theme and custom CSS for this viewer, without editing the fiber. The choice is stored locally by channel and host; blocked browser storage doesn't prevent the toggle from working for the current session.

CSS boundary

Write ordinary CSS, with :scope naming the channel's root:

:scope { --ws-paper: #f1f4eb; }
[data-part='fiber-title'] { border-bottom: 1px dotted var(--ws-hairline); }

Shuttle parses the file with a constructable CSSStyleSheet and scopes style rules through CSSOM under the channel's [data-ws-theme] boundary. Selector lists, functional selectors and CSS nesting retain their browser-defined meaning. Rules inside @media, @supports and @layer retain their conditions and are scoped recursively. Rules can't select the Desk or an adjacent channel; arbitrary selectors such as body don't escape the boundary. Nested roots reset inherited typography and custom properties, so a foreign card or a card in Plain mode doesn't inherit the open reader's theme.

Act zone

The band, a constitution view's verbs (Temper/Discard), verdict plates (and the undo line that takes their place while a verdict waits), and the fiber page's worker control are act zones, marked data-part="act". The data-act attribute identifies band, verdict or worker; it isn't permission for theme rules to enter. Each generated CSS scope stops before that zone, so even a broad button { color: red } rule can't select Temper or the worker control. The zone also resets inherited UI variables and typography to the unthemed defaults, accepting only --ws-paper and --ws-ink from the channel. Its hairlines and control fills derive from that paper and ink; its fonts, sizing and pigment meanings remain Shuttle's. This boundary is structural, not a styling convention.

@font-face definitions are hoisted as written; give custom font families distinctive names because their definitions are document-wide. @keyframes names are prefixed with the channel identity, and animation and animation-name references are rewritten to match. Only HTTPS imports from fonts.googleapis.com are retained; other imports are dropped with a console note. Other global at-rules are omitted with a console note. Relative URLs resolve against the board page; use absolute URLs or data URIs for ornaments and fonts. Custom themes are CSS, not a sandbox for untrusted network resources.

Stylesheets are removed when no reader uses them. Changing a theme repaints a paused audio waveform without replacing its player or losing playback position. Channel selection and page styling change immediately; only the veil's tint crosses over 280 ms. Reduced motion disables theme animations and transitions, and reduced transparency makes the veil opaque.

Variables

The --ws-* materials derive from the Desk's --kbn-* tokens in tokens.css. Set variables on :scope, not :root, so they apply to this channel. These are the stable styling tokens:

Variables Surface
--ws-ground, --ws-veil, --ws-veil-filter Opaque ground, translucent veil tint, backdrop filter
--ws-paper, --ws-sheet, --ws-fill, --ws-hover Page paper, stacked sheets, selection and hover fills
--ws-ink, --ws-ink-soft, --ws-ink-muted, --ws-ink-faint Main text through secondary metadata
--ws-hairline, --ws-hairline-soft Strong and soft rules
--ws-you, --ws-focus Human pigment and keyboard focus
--ws-agent, --ws-machine, --ws-machine-halo Agent ink and halo
--ws-owed, --ws-fresh Owed/waiting text and fresh-receipt dot
--ws-verdict Verdict ink
--font-serif, --font-mono, --ws-mono-tracking The serif and mono stacks, and the mono's tracking
--type-display, --type-title, --type-prose, --type-row, --type-label, --type-note, --type-meta, --type-code The type roles: fiber titles, titles and outcomes, reading text, row titles, controls, secondary lines, machine facts, code
--leading-prose, --leading-ui, --leading-tight Line height for reading text, a line of chrome, and titles
--ws-radius, --ws-control-radius, --ws-line-width, --ws-float Popover and menu shape, control shape, borders and elevation shadow

The type roles are defined once, in ui/src/styles/type.css: 12 px mono for machine facts (ids, times, paths), 14 px secondary lines, 15 px controls and labels, 16 px row titles, 18 px prose, 21 px titles and outcomes, 34 px fiber titles, and code at 0.9 of its surrounding text. Each role names its family: mono is for what a machine wrote or a person types, and every label a person reads is serif. A theme restyles fonts, sizes and leading by setting these variables on :scope. Act zones keep Shuttle's default typography.

Set related text and background tokens together and check contrast. Ordinary text needs at least 4.5:1 contrast; large text needs 3:1. Workspace layout measures also live in tokens.css, but changing page geometry, timing or touch-target sizes isn't part of this styling contract.

Parts

These hooks are stable; renaming or removing one is a theme-breaking change.

Selector Part
[data-part='veil'] Still backdrop beneath the reader
[data-part='label-bar'] The page's header line: back, name, arrival and its controls
[data-part='page-frame'] The page's paper, filling the stage beneath its header line
[data-part='fiber-header'] Fiber status header
[data-part='fiber-title'] Constitution title
[data-part='act'] Scope limit, not a styling hook; the band, verdicts and workers
[data-part='prose'] Fiber article or text/Markdown pane
[data-part='prose'] h1, h2, h3, p, blockquote, code, table, hr Prose elements; prefix each with the prose selector
[data-part='thumbnail'] Shared preview's UI paper
[data-part='thumbnail-face'] Designed text face beneath a loaded preview
[data-part='phone-topbar'] Reader navbar; top bar on phone
[data-part='audio-page'] Listening page and comparison list
[data-part='audio-waveform'] Canvas; its CSS color sets the played waveform ink

The same CSS is used on reader and compact channel roots. Keep card and row ornamentation light, preserve their density and touch targets, and don't use pseudo-elements that intercept clicks or cover controls. Thumbnail paper and text faces can be styled; the HTML, PDF and image contents of loaded previews keep their own appearance. The page frame meets the stage's edges at every width: a theme gives it ground, grain and ink, never a radius, clip path, border or shadow.

Pigments

The board's pigments carry meaning: cinnabar = you, cobalt = agent, gold = owed or fresh, verdigris = verdict, iron gall = chrome and ordinary text. Themes are asked to preserve those meanings rather than painting every control with an agent or attention color. Shuttle doesn't enforce the convention; the bundled themes demonstrate it, with lighter pigment inks on dark paper.

Example: a field notebook

Set theme: laboratory-paper, then add this theme.css beside the fiber:

:scope {
  --ws-paper: #f4f6ed;
  --ws-hairline: #66735f;
}
[data-part='fiber-title']::before {
  content: 'FIELD NOTE / ';
  display: block;
  font: var(--type-meta)/2 var(--font-mono);
  letter-spacing: .12em;
  color: var(--ws-ink-muted);
}
@keyframes settle-ink {
  from { opacity: .6; }
  to { opacity: 1; }
}
[data-part='fiber-title'] {
  animation: settle-ink 280ms ease;
}

The flourish belongs to the fiber page, not the HTML report. The animation name is private to this channel, and reduced motion suppresses it.