Standard for the docs site and the preview

Visual system

The docs site and dharmatiles preview share one stylesheet, docs/assets/theme.css, with one set of fonts and one logo. The preview serves the same files from inside the program. Anything new on either one uses these tokens and controls, never its own.

The plate

A tile is always shown the same way: on the pale light-box plate (--plate, #D9E0EB) that the renderer uses as its background, ruled in squares. The plate is the same colour in both themes, so a render on the site and the live view in the preview look alike. Every screenshot sits on it, element cards without a picture show their name on it, and the preview's stage is the plate with the tile's own 35 mm grid.

a tile goes here

Anything laid over the plate, such as the preview's hints, uses the plate's own light colours in both themes. The status line and the messages panel are not laid on the plate but are the page's own surfaces, in the theme's colours: a mistake is marked with --err, a note with --caution, and the legend at the panel's foot, which explains the model's colours, uses --over and --band.

Colour

The light theme is Lichen & Linen: unbleached paper, stone grey and botanical green. The dark theme is Moonpool: near-black marine blue, sea-glass cyan and cool periwinkle. Their accent marks anything you can press or that is chosen. Every other colour has one meaning.

Linen / moonpool--bg, --panel, --raised: the page and its surfaces
Ink--ink, --muted: text
Lichen / sea glass--accent: links, chosen buttons, focus, the lotus and editor selection. Nothing else.
Periwinkle--ref: in the editor, the places a selected region is made from (the edges, lines, points and regions its source names), drawn and labelled beside it
Plum--point: in the editor, the control points a selected line or region refers to (each through and fill point and each within centre), marked and labelled with their source text
Cloud blue--cloud: in the editor, a selected cloud (a top= or a pin): its sheets, the span at each tree tip or stone and its marker, drawn on the model in a colour of their own so they never read as the selection’s outline
Overhang red--over: faces past the limit, gate failures, errors
Band orange--band: 55–65°, allowed within budget
Caution yellow--caution: a note (a tile that passes but wants a look, such as dt::steep): its dot and stripe in the editor's messages panel and its mark in the source. The debug layer's yellow (--dbg-cut), the same in both themes. Only a dot, a stripe or an underline: text on it stays --ink
Earth--earth: surfaces (dirt, flagstones, planks)
Stone--stone: things (rock, scatter, cliff, wall)
Moss--moss: plants, and “passes the gate”
Water--water: water, and properties in .dtile code
Plate--plate: where tiles are shown; the same in both themes

On a model, red and orange paint overhang: --over past the steepest angle, --band in the band. In the interface, --err is the danger colour for errors and destructive actions such as Delete, as in most toolkits. The two may look alike; they are separate tokens, so changing one never changes the other. Nothing decorative uses either.

The editor's debug layer draws on the model with its own --dbg-… tokens (blade spines, blade starts by fate), the same in both themes like the plate. None of them is red or orange. A selected cloud is drawn in --accent, as a selected place is; its shade is the mark's opacity, not another colour.

Type

Big Shoulders Display
names and headings
2x1-cliff-escarpment
IBM Plex Sans
reading and controls
Every tile passes a printability gate before it is written.
JetBrains Mono
what you type
scatter at=pool count=2 { rock size="6dmm .. 10dmm" }

All three are self-hosted in docs/assets/fonts/ (SIL Open Font License), so the preview works offline. Monospace is only for text you would type into a .dtile or a terminal: element names, values with their units, seeds and the source. Sentences, words, family lists and word values (wavy, ground level) are Plex. Numbers in records use tabular figures.

The scale

Four sizes, each with its line height, as tokens in theme.css. Every font-size and font of the preview and of the shared chrome reads one of them; 12 px is the floor, and a test fails on a raw size.

--fs-s
12 px / 16 px. Captions, counts, keys, the status line, segmented controls.
--fs-m
14 px / 20 px. Rows, values, buttons, inputs, messages.
--fs-l
17 px / 24 px. The name of something, where it is not the thing itself.
--fs-xl
24 px / 28 px, Big Shoulders. The thing itself: the name at the top of a level, a dialog’s title, the wordmark.

Case

Headings and labels are sentence case, with no all-caps labels and no tracking. A label is .cap: 12 px, weight 600, in --ink. The quiet comes from its size and the hairline above its block, not from grey; one class does it for section captions, menu captions and dialog eyebrows, and a test fails on text-transform: uppercase.

Headings climb at every width: the page title is always larger than its section titles (title 64 px, sections 36 px, subsections 24 px on a laptop; 40, 28 and 22 on a phone). Text has one reading measure, --measure (33em, about 66 characters). The column beside it holds the contents list, and, on a page that has a picture to put there (the element pages' renders), the picture. On a phone the contents list is folded above the content.

Controls

One look and one behaviour each, on the site and in the preview:

.btn
An action, 30 px tall (--h-md); .btn.sm is 24 px (--h-sm). aria-pressed="true" fills it with the theme accent.
.seg
One choice from a row, 30 px outside and 24 px inside: the preview's views and its My tiles / Library / Tests switch. A track wider than its buttons shares the room out between them (one rule), so a segmented control never ends short of its track.
input, select
30 px tall. Every text-like input and every select takes the control style (a 1 px line, the theme radius, the body face), chosen by what the one rule leaves out, never by a type it names: an input with no type, or a new one, cannot fall back to the browser’s own. A test fails on a bare one.
.switch
On or off, with its keyboard key beside it when it has one.
Sun / moon
Light or dark. It follows the system until it is used, then remembers the choice (dt-theme in the browser).
.scrolls
A scrolling panel in the preview's chrome (never the 3D view): a soft shadow, --scroll-shadow, at each edge that has more content beyond it, gone when scrolled to that edge. js/scroll-shadows.js sets the edge classes.
.copy
Copying a value, anywhere: a small copy icon that turns into an accent check mark for a moment once the value is on the clipboard, or a labelled button whose words read “Copied”. Made by copyButton() in the preview's js/copy.js; never a hand-made copy button. If the browser refuses the clipboard, the button says so.
Focus
A 2 px accent outline on every control.
.dtile code
Coloured by site.js: node names (and the header line's dharmatiles) use the accent, properties water, strings moss, comments muted. Inside a string, a $name takes the node colour and a number with its unit (8dmm, 90deg, 50%) the number colour, earth.

Sizes, corners and marks

--h-sm, --h-md
Two control heights, 24 px and 30 px, on a 4 px grid. Buttons, inputs, selects, icon buttons and the title bar’s chips are 30; a segmented control is 30 around buttons of 24; the small buttons of a row, the steppers and the dice are 24. Rows are 30, or 48 with a second line. A test fails on a control height between 17 and 29 px that is neither.
--r, --r-lg, --r-mark
The only corners. --r is every control, chip and tag; --r-lg is a menu, a card or a dialog; --r-mark (2 px) is a mark, a bar or a swatch. There is no pill: where a count needs a chip it is a square-cornered one. A round thing (the slider’s thumb, the debug layer’s dot swatch) says so with a comment, and a test fails on a radius that is none of these.
.dot
The status mark: one 8 px square (--mark, --r-mark), in --ok when ready, --err when failed, --caution for a note, --accent and pulsing while it builds. A tile in a folder, a stack row, a message and the status line all draw it.

Icons

One set, drawn by web/preview/js/view/icons.js as inline SVG in the current colour, through one helper (Icon for a component, iconSvg for a string, fillIcons for the marks in index.html). The arrows, the check, the cross, the ellipsis, the sun and moon, the turn arrows and the panel toggles are Lucide (ISC licence, kept in web/preview/vendor/LICENSE-lucide), a 24 grid with a 2 px stroke, round caps and joins, shown at 16 px (14 inline, 20 for a folder or a camera). The folder glyphs and the dice are drawn in the same way. No icon is a text character: a test fails on ›, ×-only buttons, ⋯, ▾ and the like standing in for one.

The nine cameras follow the standard views of CAD programs: the six sides are a see-through cube with the face you look straight at filled (Top, Front, Right, Back, Left, Under); the angled views are the cube drawn solid in three tones (Iso), on a dashed ground line with a thin top (Low), and cropped by a dashed frame (Close-up). Each is drawn in currentColor and the accent, so it works in both themes, and all nine differ.

Rules