Design Conventions
How the browser tools on this site are built, why they ended up that way, and what went wrong along the way.
This site hosts a few dozen interactive tools. They grew over several months, mostly written with a coding assistant. The style below was not designed up front. It accumulated, was wrong several times, and settled into a small set of shared components once the cost of per-tool variants became clear. This page covers the stack, the color system, the components, and the specific mistakes each rule exists to prevent.
The page describes; it does not prescribe. The reasons behind each convention are the part that transfers to other projects. A value copied without its reason is right in one theme and wrong in the other two. That happened here repeatedly.
The three files that carry the system
https://alber.me/assets/css/pico.min.css– Pico CSS v2, unmodified. Semantic, nearly classless, MIT.https://alber.me/assets/css/custom.css– everything described below. Each block carries a comment explaining why it looks the way it does. Where this page and that file disagree, the file is the authority.https://alber.me/assets/js/icons.js– the button icon set, around 4 kB, no dependencies.
For the single-file no-build stack there are also
/assets/js/react.production.min.js,
/assets/js/react-dom.production.min.js and
/assets/js/htm.js, all vendored locally.
These files are meant to be copied into a project. Hot-linking them is a bad idea: this is a personal site with no CDN guarantees, and the files change.
Every page under /miscellaneous/tools/ is a worked example with readable source. There is no build step, so the file in the browser is the file that runs.
Roughly the second half of custom.css is specific to this site: the per-section
color schemes, the breadcrumb header, the wordmark, the view-transition animations for
theme and language switching, the landing page accordion. The first half generalizes to any
small web app: the color ladder, the components, and the reasoning that decides which
component a given control is.
1. The stack, and why one file
One .html file per tool. React 18 and htm from local
<script> tags, no bundler, no package manager, no npm, no CDN request of
any kind. The app renders into <div id="root">. Where a tool needs data,
it fetches static JSON next to the page.
The single file started as a constraint of GitHub Pages. It became the most useful property of the whole setup. A tool is one artifact: it can be emailed, dropped on a network share or opened from a USB stick. Nothing has to resolve, so it still works years later. On a locked-down network there is no proxy to negotiate with, no registry, no allowlist and no supply chain. The single file has a real cost as well; the next section covers it.
Self-containment has one exception. Logic that a second tool needs becomes a shared module with its own test. Copies drift, and the drift is always found long after the copy was made.
Each file has two named script blocks. The app block holds the React component tree. The
real logic (the math, the parsing, the geometry) sits above it in a separate block. That
block's id ends in core, abbreviated per tool: erocore,
ebookcore, lambdacore. It holds pure functions: no markup, no DOM
access. The Node tests hang on this block. A test reads the HTML file, pulls the block out by
its id and evaluates it, with no browser and no rendering.
The skeleton, minus this site's own chrome:
<!doctype html>
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>…</title>
<link rel="stylesheet" href="assets/pico.min.css">
<link rel="stylesheet" href="assets/custom.css">
</head>
<body>
<main class="container"><div id="root"></div></main>
<script src="assets/react.production.min.js"></script>
<script src="assets/react-dom.production.min.js"></script>
<script src="assets/htm.js"></script>
<script src="assets/icons.js"></script>
<!-- Pure functions, no markup, no DOM. This block is the seam that makes the
tool testable from Node: a test reads the file, pulls the block out by id
and evaluates it. Renaming the id, or folding the code into the app block,
breaks the tests with an unhelpful "no block found". -->
<script id="xycore">
function computeSomething(a, b) { … }
</script>
<script id="app">
const html = htm.bind(React.createElement);
const { useState, useMemo } = React;
function App() {
return html`<h1>…</h1>`;
}
ReactDOM.createRoot(document.getElementById('root')).render(html`<${App} />`);
</script>
</body>
</html>
The core block is useful even without a test suite. It keeps the math apart
from the DOM. A function that needs the DOM to run cannot be checked by reading it or by a
script.
2. htm instead of JSX: the trade, the traps, the checker
Until August 2026 every tool loaded babel.min.js (3.0 MB) and compiled its JSX
in the visitor's browser on every page load. There is no build step to do it earlier.
htm (1.3 kB, MIT) replaced
Babel. With htm, the markup is written as tagged template literals. Tagged template literals
are valid JavaScript, and the browser runs them directly. All 36 tools were converted in one
campaign, and Babel was deleted.
The gains, recorded here so they are not traded away later:
- 3.0 MB less per page load, and no compile pause before first paint.
- The app block is plain JavaScript. Node can evaluate the whole app block directly, beyond the
coreseam. Whole-tool testing became possible this way. - An old rule against
async/awaitdisappeared with Babel. The rule was never a style choice. Babel's preset-env rewrote both keywords toregeneratorRuntime. That runtime was not loaded, and the page rendered blank.
The single line at the top of every app block:
const html = htm.bind(React.createElement);
The traps, all verified against the vendored copy
htm itself never throws. A mistake silently produces a different tree.
The two loud failures in the list come from elsewhere: React rejects a string
style (item 1), and the JavaScript parser catches one typo (item 11). Silent
failure is the expensive half of the trade. A coding assistant makes it worse: models are
trained mostly on JSX and reach for JSX spellings by reflex. Every item below is a bug that
shipped here at least once.
stylemust be an object.style=${{ marginBottom: 14 }}. A string throws React error #62 at render time. The result is a blank page with a minified error number and no other clue. This trap costs an hour every time.- Attribute names stay React names:
className,htmlFor,strokeWidth. htm passes props toReact.createElementuntouched and maps no HTML names to React names.class=andfor=therefore fail silently. ${…}, not{…}. A forgotten$turns an interpolation into literal text, or into an attribute holding a braces string. No warning.<>is not a fragment. htm reads it as a tag with an empty name and hands""tocreateElement. The fragment is<${React.Fragment}>…<//>.- Void elements need closing.
<div>a<br>b</div>parses as adivcontaining"a"and abr. Thebrswallows"b"and everything after it, including thediv's own closing tag. - HTML entities are not decoded. Babel decoded
×and in JSX text. htm passes the literal characters through, and the page shows the entity. The tools here use the character itself instead, or a\uescape inside an interpolation. - Comments are
<!-- … -->. JSX comment syntax inside a template renders as text. - A missing closing tag silently nests the following siblings inside the open element. Also no warning.
- Multiple roots return an array. htm builds no fragment, and React then wants keys on the array. Deliberate multi-root templates get wrapped in
React.Fragment. - Every nested template needs its own
htmltag. A bare backtick string inside${…}becomes text. - The one typo that is caught, but misreported:
<//>}instead of<//>`}. The missing backtick closes a nested template; it belongs before the brace that closes the interpolation. Two agents converting different tools made this typo independently. It is a syntax error. V8 reports it as "Missing } in template expression" and points at the outer template's line. Bisecting with a standalonevm.Scriptparse finds the real spot.
The conversion table used during the migration:
JSX htm
return ( <div…> ) return html`<div…>`
{value} ${value}
attr={value} attr=${value}
attr="literal" attr="literal" (unchanged)
{items.map(x => ( <li…> ))} ${items.map(x => html`<li…>`)}
{cond && <p/>} ${cond && html`<p/>`}
{/* note */} <!-- note -->
<>…</> <${React.Fragment}>…<//>
<Comp x={1}/> <${Comp} x=${1}/>
{' '} ${' '}
{...props} ...${props}
key and ref are ordinary props to htm and get picked out by
createElement exactly as with JSX.
The checker, which is the part worth stealing
Silent failure needs a mechanical check. The migration ran against one. For each tool, the
unconverted version stayed in git HEAD and the new version stayed unstaged. The
checker pulls the old JSX out of git and compiles it with Babel. It runs the new htm source
against the same stub React. Then it diffs the two element trees, which have to be
byte-identical. The order was convert, check, commit, one tool per commit. A regression is
therefore one git revert.
A tree comparison at initial state proves almost nothing. Every conditional branch, tooltip
and modal stays unrendered there. Each tool therefore has a scenario table with injected
useState values. Five lessons about that table came the hard way:
- Real data, not fixtures. For a tool that fetches, the checker reads the actual JSON. Two tools compare trees of 10,572 and 15,852 lines that way. With a two-row dummy, both comparisons would have proved nearly nothing.
- The injector counts
useStatecalls in render order. Positions past the root component's own hooks land in whichever child rendered first. Interesting state often lives in a child. - A wrong scenario usually shows up as an error. The error is the check working: passing a string where a multi-select wants an array throws.
- …except when it shows up as a pass. Values on the wrong hook positions still render a valid tree. Both versions then render the same wrong state. The branch the scenario was meant to enter is never entered. One tool lost two states from its documented order, which shifted every position from 13 on. Only one of eight affected scenarios failed loudly. A green scenario does not prove its branch ran. An audit script now compares every documented order against the code.
- Equal tree sizes across different scenarios are a warning sign. For a while the resolver dropped the children of every component it resolved. Everything inside a
<Section>or<Card>was then missing from the comparison on both sides. The giveaway: scenarios that opened different panels reported identical trees.
Two rules around the checker mattered more than its code. First, the checker is never weakened to reach a green result. A diff is a fault in the tool, never in the checker. Scenarios get added, never defanged. Second, a conversion contains no reformatting and no drive-by improvements. A pre-existing bug found on the way gets reported, then fixed afterwards in its own commit. The equivalence check only proves the tree is unchanged. It cannot tell an intentional improvement from a mistake, and a diff that mixes both is unreviewable.
Node proves the tree. It does not prove the rendering. Every conversion was therefore followed by a browser pass: the page renders at all (blank means broken), the console shows no React warnings, every interactive control works, the live language switch and the live theme switch work, and any canvas or SVG redraws on the theme event.
The repo keeps this material as a Claude Code skill,
.claude/skills/jsx-to-htm/SKILL.md. A session that hits an htm bug finds it
there without being told. The equivalent place for GitHub Copilot is
.github/copilot-instructions.md, or a scoped
.github/instructions/htm.instructions.md. The trap list above is the valuable
part. The rest is bookkeeping specific to this repo.
htm has a real cost: no editor support inside the markup. That means no highlighting, no type checking, no linting and no rename across the file. htm is the right choice where the single file is worth more than that tooling. Where a build step is allowed and the tooling matters more than shipping one artifact, JSX and Vite are the better answer.
File size turned out not to matter, which was a surprise. The largest tool here is just over 10,000 lines in one file. The next two are 8,500 and 7,400 lines. All three are htm without a build step, and the line count never hurt. The pressure came from the trap list above and from the absence of module boundaries.
3. Color: a ladder of roles, three skins
The site has three skins: light, dark and
grey. The choice lives in data-skin on
<html>. Its polarity lives in data-theme. Grey is therefore a
dark skin: it inherits the dark rules and then overrides them. Grey tells elements
apart by outline instead of fill. Page and panels are the same gray, there are no shadows,
and there is one single accent. Grey turned out to be the most useful skin. It exposes every
place where color was doing work that structure should have done.
No tool writes a gray or a border color as a hex value. Each tool uses a rung of a ladder,
named by role, and gets all three skins for free. The dark values are constructed
in OKLab: hue 250°, even lightness steps, chroma rising toward the dark end. Three rungs
leave the even steps to meet a contrast floor. Every text rung reaches 4.5:1 against the
tool surfaces, and the border rung reaches 3:1. The light and
grey sets keep the roles and change the numbers. All values are generated, not picked by
eye. The table below therefore gives only the dark rungs. The light and grey counterparts
live in custom.css under the same names. A copy here would be a second copy to
keep in sync.
| Variable | Role | Dark |
|---|---|---|
--tool-emph | emphasized text, card titles | #e1e8f0 |
--tool-text | body text, h1 | #bcc5cf |
--tool-label | labels, secondary text | #99a4af |
--tool-note | footnotes, meta text | #8d9aa7 |
--tool-faint | disclaimers | #808f9f |
--tool-border | frames, button outlines | #68798a |
--tool-hairline | separators inside a panel | #1a2a3a |
--tool-grid | chart grid lines, plot frames | #45596d |
--tool-surface | card and plot background | #111c28 |
--tool-panel | panel and popover surface | #0a1928 |
--tool-ink | dark text on a light chip | #0a1928 |
Two rungs that look identical in dark, --tool-ink and
--tool-panel, are separate on purpose. In the grey skin the panel takes the page
color, while chip text still has to be dark. Two roles that share a value in one theme are
still two roles, and another theme will pull them apart.
On top of the ladder sit four callout groups, each with -bg,
-border and -text (--tool-ok-*,
--tool-warn-*, --tool-info-*, --tool-danger-*), four
signal colors for readouts and plot marks (--tool-sig-good,
-warn, -bad, -info) and
--tool-shield-* for the privacy badge. The light signals sit two steps darker
than the dark ones. A Tailwind-400 green on white is a pastel nobody can read.
Canvas and WebGL have to be told
CSS variables reach the DOM. They do not reach a canvas. Some tools bake palette values into
JavaScript. Those tools read the values once through a readPalette() into
mutable bindings. When the theme changes, they re-read the values and redraw:
function readPalette() {
const cs = getComputedStyle(document.documentElement);
return { text: cs.getPropertyValue('--tool-text').trim(), … };
}
let PAL = readPalette();
window.addEventListener('themechange', () => { PAL = readPalette(); redraw(); });
themechange is a custom event fired by this site's own switcher. Elsewhere a
MutationObserver on data-theme does the same job. Eight tools here
need the redraw. A missing redraw looks like a rendering bug that appears only after a theme
switch.
Some fills are computed from data instead of themed, such as heatmap cells. On those, the
text color is picked by luminance: dark #1e293b above 145, light
#f1f5f9 below. These two colors are inputs to a calculation and stay literals.
Colormaps
Colormaps come in two families. The data decides which one a tool takes. A diverging map is for a signed quantity with a meaningful zero. There, the question is which side of the middle a value falls on. A sequential map is for a quantity that only goes up. There, the middle means nothing, and a diverging map would spend its strongest contrast on a meaningless middle.
The diverging maps are the shared convention: three RGB triples, interpolated linearly.
hollywood is the default, named after the orange-and-teal film grade it comes
from. No single default serves everyone, so there are alternatives: greyscale
for printing, tritanopia for blue-yellow color blindness, and the ColorBrewer
scales for readers who already know them.
hollywood: { neg: [255,140,66], mid: [245,245,245], pos: [0,139,139] } // default
greyscale: { neg: [0,0,0], mid: [128,128,128], pos: [255,255,255] }
tritanopia: { neg: [200,85,61], mid: [245,245,245], pos: [74,172,143] }
rdbu: { neg: [33,102,172], mid: [247,247,247], pos: [178,24,43] }
rdylgn: { neg: [215,48,39], mid: [255,255,191], pos: [26,152,80] }
spectral: { neg: [213,62,79], mid: [255,255,191], pos: [50,136,189] }
puor: { neg: [230,97,1], mid: [247,247,247], pos: [94,60,153] }
brbg: { neg: [140,81,10], mid: [245,245,245], pos: [1,102,94] }
The sequential maps are not shared. They need more resolution than three stops, and only two
tools have data of that shape. The sun-hours map offers viridis,
plasma, inferno, magma and four older matplotlib
ramps. Each is sampled at nine evenly spaced points and interpolated in between. Next to
them sits one hand-built ramp that puts its yellow late. A fully sunlit courtyard is the
exception in the data, so the yellow is reserved for the top of the range. The wave tool
samples at eleven points. For two of its maps, eleven points is exactly the published anchor
list, and nothing is approximated at all.
These ramps are trustworthy because none was written from memory. The numbers were read out of matplotlib 3.11. A ramp typed from memory differs from the ramp it claims to be, and nobody can tell by looking.
Most of these maps are other people's work. rdbu, rdylgn,
spectral, puor and brbg are
ColorBrewer diverging schemes. They
are the cartographic work of Cynthia Brewer at Penn State, taken here in the form matplotlib
ships under the same names. Their color specifications are published for reuse under an
Apache-style license. Using them is a matter of attribution; the license permits it.
On the sequential side, Nathaniel Smith and Stéfan van der Walt designed
viridis, plasma, inferno and magma for
matplotlib and released them into the public domain. The older ramps beside them are
matplotlib's, with a longer history. The wave tool also uses Managua from
Fabio Crameri's scientific
colour maps. Managua is dark in the middle: still water reads dark, crests and troughs
both read light.
Four maps are local to this site: hollywood, greyscale,
tritanopia, and the hand-built sun ramp. Nobody else is responsible for them.
The table above hides one loss. A ColorBrewer scheme is specified at more than three stops. Sampling it down to a negative end, a middle and a positive end, then interpolating linearly, throws away most of its perceptual design. The hue pairing and the neutral midpoint survive, and those are the parts these tools use. A genuinely uniform ramp needs the full stop list, or a perceptual map such as viridis.
Colormaps are the one part of the color system outside the ladder. They do not switch with the skin, because they encode data. A scale that changed meaning on a theme switch would make a different chart.
Colormaps are also the one place where centralizing was tried and abandoned. The plan was a single map set for the whole site, on the same reasoning that produced one button and one segmented control. The plan failed because what looks good depends on what is drawn. A sauce comparison table, a moving wave field and a map of annual sunlight hours want different ramps. One set for all three made each slightly worse, for a consistency nobody would notice. Code is shared across the site; colormap choice stays with each tool.
4. The components
Everything in this section is defined once, centrally. The most expensive habit on this site was a tool inventing its own version of a control that already existed. An audit in August 2026 found roughly eighteen distinct size sets for the ordinary button. It also found nine files carrying a byte-identical rule body under nine different names. Consolidating them took a week. A shared class from the start would have avoided that week entirely.
Action buttons
Live, and restyled by the theme switcher above
<button type="button" class="tool-btn">Download</button>
<button type="button" class="tool-btn tool-btn-sm">Copy</button>
<button type="button" class="tool-btn tool-btn-primary">Generate</button>
<button type="button" class="tool-danger">Reset everything</button>
<button type="button" class="tool-danger tool-btn-sm">Remove</button>
<button type="button" class="tool-linkbtn">show 40 more</button>
.tool-btnis the base: outline on--tool-surface,0.4rem 0.9rem,0.8rem, radius 8. It isinline-flexwithgap: 7px, so an icon needs no second rule. These values were measured: nine independent attempts converged on them.width: autoandmargin: 0counter two Pico defaults. Pico givesbutton[type=button]a bottom margin and stretches submit buttons to full width. Either default wrecks a row of buttons..tool-btn-primarymarks the one main action of a view. With two primary buttons, neither means anything..tool-btn-primaryis deliberately different from Pico's filled accent button. Eight tools used the filled button, and it was the loudest object on the page. In the grey skin nothing else is saturated, and the Generate button was the only colored thing on screen. The primary button uses the info group: the quietest signal that still lifts it out of its row..tool-dangercarries the destructive colors. On its own it is the prominent button for a page-wide action, like "Reset everything" above..tool-btn-smnext to it acts as a pure size modifier, and the colors are never restated..tool-btnnext to it does the same at full size, for a destructive button in a row of ordinary ones. Two tools used to re-declare the three reds at a specificity that beat their own button class. The colors then existed twice and could drift..tool-linkbtnis a button that is really a link. Its underline is permanent. An underline that appears only on hover says nothing until the pointer is already there.
Icons
ToolIcons.el(name, props) returns a React element,
ToolIcons.html(name, size) the same icon as a string. Inline SVG, 14 px,
fill: none, stroke: currentColor, width 2, round caps. Available:
download upload copy reset remove play pause check plus external link search tune text dice pipette merge.
With currentColor, the icon takes the button's text color in every skin and in
the hover and disabled states. No extra CSS rule is needed.
Three conventions govern the icons. All three are about restraint:
- An icon marks a button that performs an action on something: download, upload, copy, run, reset, remove, open elsewhere. Choices, filters, tabs and next/back stay bare. In a row where every button has a picture, the icons stop carrying signal.
- No emoji. An emoji is an image supplied by the operating system. Windows, macOS, Android and Linux each draw a different picture, in a fixed color and a fixed stroke weight. An emoji follows neither hover nor the disabled state. In the deliberately colorless grey skin, it is the one bright spot on the page.
- Removal is an X, never a waste bin, at every size, from a chip corner to "reset everything". A test asserts this. The same test guarantees that no icon carries a hardcoded color.
Text fields, and Pico's specificity trap
Live
Pico's rule is input:not([type=checkbox],[type=radio],[type=range]). It puts a
fixed height on the element. Pico computes that height from 1rem,
not from the element's own font size. With Pico's defaults and its root scaling above
1280 px, the field is 62 px tall. The button beside it is 41 px. A field half again as tall
as its neighbor looks wrong on the page. Four tools fell into the traps that follow:
- Setting only
font-sizegives small text in a tall box. - Setting only
paddingdoes nothing to the height. The padding is redistributed inside the fixed height. The fix takesheight: auto. - A bare
.tool-inputloses on specificity, because the attribute selectors inside:not()count.input.tool-inputmerely ties, and source order decides. A dozen tools got their padding to apply by that accident. Repeating the:not()list settles the contest.
The shared classes are .tool-input, .tool-input-sm and
.tool-input-inline. .tool-input-inline releases the width from
Pico's 100%, for a field in a chip row instead of a label grid. The geometry of all three
matches .tool-btn exactly, and a field and the button next to it line up to the
pixel. Background, focus ring and validity states stay Pico's. A field therefore still reads
as something to type into.
Tabs choose a VIEW, segmented controls choose a SETTING
Both components exist for this distinction. A view switch built as a segmented control looked exactly like the half dozen settings underneath it. The choice that decides what the page shows then read as one option among many. Underlined tabs say "these are the sections".
Live: tabstrip, joined seg-row with a disabled segment, gapped chip row
<div class="tabstrip" role="tablist">
<button role="tab" class="active">Chart</button>
<button role="tab">Table</button>
</div>
<div class="seg-row">
<button class="lang-seg active">Before</button><button class="lang-seg">After</button>
</div>
Tabs take no class per button, only role="tab" and active. Margins
stay with the page. The strip sits at a different distance from its neighbors on every
page.
Segments are .lang-seg. The name is historical: the class serves every
segmented control, beyond the language switcher. Corners follow DOM
adjacency, keyed on :has(+ .lang-seg) and + .lang-seg.
The earlier version keyed on :first-child and :last-child. That
only held when the segments were the sole flush children of their wrapper. A lone button
came out rounded on the right only, and half a dozen tools carried a local patch for it.
With adjacency, a lone button needs no patch, and a group still joins seamlessly.
Every segment keeps all four of its own borders. The row overlaps neighboring borders by
margin-left: -1px, and z-index raises the active, hover and focus
states. Before that, the left neighbor handed over its seam with
border-right: none. That approach broke twice:
- A border shorthand resets all three sub-properties, color included. Eleven tools restored the seam for their gapped chip rows with width and style but no color. That one edge was then drawn in the button's text color and looked thicker than the other three. The comment at the rule claimed the shorthand only removed the style. The comment was wrong, and it copied the bug into all eleven tools.
- An active segment in the middle recolored its border to the accent. It had no right border left to recolor. The neighbor drew that right-hand seam in gray, and the selected segment looked cut off on one side.
The new geometry has a cost. Squared corners and overlap are the default for adjacent
segments, and adjacency cannot see a gap. Some gapped rows hold
separate actions instead of one control. Such a row opts out with two declarations
on its own row class:
.qr-chips > .lang-seg { border-radius: 4px; margin-left: 0; }
There is deliberately no shared .chip-row. Each such row needs a class of its
own for gap and sizing anyway. An earlier failure shaped this decision:
.seg-row was referenced in comments for two weeks and never actually
defined. Seventeen tools hand-rolled it in three mutually incompatible geometries. A
class named in comments but never defined did more harm than no name at all.
Info folds
Live
How this is calculated
The body is indented behind a hairline and set slightly smaller and muted. No border, no background, no box: a fold holds prose a reader may skip, so it must not look like an object.
<details class="fold">
<summary>How this is calculated</summary>
<div class="fold-body"><p>…</p></div>
</details>
The fold-body wrapper is mandatory: the hairline hangs on it. Folds carry no
local chevron or marker CSS. The paragraphs inside carry no inline colors or font sizes,
because fold-body already styles them. fold-sm is the compact
variant for dense result areas.
The fold is for prose only. Functional disclosures kept their own designs: control sections,
edit panels with forms, advanced-option panels, popovers, show-more links, list accordions.
The native <details> replaced every React "show notes" toggle on the
site. A <details> prints, the browser's own search finds its text, and it
needs no state.
The control card
The control card is for tools whose parameters form groups. One card holds all the groups. Hairlines separate the groups inside it; no group gets a box of its own.
Live
Rainfallper iteration
Advanced
Sediment
<div class="ctl-card">
<div class="ctl-sec">…fields…</div>
<div class="ctl-sec">
<p class="ctl-sec-h">Group<span class="ctl-sec-h-sub">aside</span></p>
<div class="ctl-group"><p class="ctl-group-h">Subgroup</p> … </div>
</div>
<div class="ctl-sec"><details class="ctl-adv"><summary>Advanced</summary> … </details></div>
</div>
What went wrong on the way to this design:
- A stack of separately bordered panels was the first attempt, for half a day in two tools. It lost: four borders, four shadows and four gaps for one block of controls. Bordered panels also borrow the frame convention, and each group then looks like a thing being shown.
- The card uses the plot frame's values. The parameter card and the chart below it therefore agree.
- The section header is a
<p>, not an<h3>. The header labels a control block; it is not document structure. Below the tool'sh1there is no meaningful heading level for it. As a1.05remheading it was as loud as the fields and still did not separate the group. At0.9emit works. At that size the header only has to stand out from the field labels below it, which are0.85em. - A section whose single control already names itself takes no header at all (a switch, a segmented control). Two independent switches are two sections, separated by the hairline, and neither needs a label.
.ctl-sec-hisdisplay: flex. A switch can then sit in the header and turn the whole section on..ctl-group-his uppercase with letterspacing. It is neither bigger nor bolder, and it never outweighs the header above it. It sits on--tool-hairline. A line inside a section has to stay lighter than the line between sections.- The field grid inside stayed local to each tool. Column widths follow the content, and content differs per tool.
The dual slider
Two handles on one track, for the two ends of one quantity: a daily minimum
and maximum, a rank from and to, a year range. Two [type=range] inputs lie on
top of each other, with their own rendering zeroed out. The visible parts are
.dual-track, .dual-fill and two .dual-dot spans.
Live
Range 25 to 70
<div class="dual-range">
<div class="dual-track"><div class="dual-fill"></div></div>
<input class="dual-thumb" type="range" …><span class="dual-dot"></span>
<input class="dual-thumb" type="range" …><span class="dual-dot"></span>
</div>
The dual slider takes Pico's --pico-range-* variables and has no values of its
own. Three tools use it, and in all three it stands directly next to ordinary single
sliders. It has to look like them in every skin. Before it was shared, it existed three
times, with three different hardcoded accent colors.
Four details are load-bearing. Each was a bug once:
- The selector carries the element (
input.dual-thumb). Pico's[type=range]has the same specificity as a bare class and would otherwise win. - All four track pseudo-elements are zeroed. Without that, Pico paints a second gray track over the visible one, sticking out at both ends.
- The input overhangs the track by 10 px on each side, exactly half the thumb width. Natively, the thumb's center only travels from 10 px to width minus 10 px. The dot travels from 0% to 100%. Without the overhang, thumb and dot stop lining up at the ends. A different thumb width changes both numbers.
- Focus and active states reach the dot with
+, not~. The order is input, dot, input, dot.~would also hit the second dot and light up both handles when one is grabbed.
Three things stay with the tool: its own margins; --dual-ring, if the slider
sits on a card instead of the page surface; and the z-index swap that brings the lower
handle forward once the two handles are close together. Without the swap, the handle at the
stop can no longer be grabbed. The swap depends on the tool's step size.
Frames, and the opposite of a frame
Anything that shows something (an SVG plot, a canvas, an image preview, a parameter map) sits in the same frame. The frame is border, radius and shadow:
border: 1px solid var(--tool-border);
border-radius: 8px;
box-shadow: var(--tool-panel-shadow);
The background is not part of the frame. A surface keeps its own background where it has
one: a checkerboard for transparency, a gradient, a 3D scene. Rounded corners over canvas
content need overflow: hidden on the container. The frame belongs on the
element inside a scroll wrapper. A frame on the wrapper itself scrolls out of view
when the content is panned sideways.
A drop zone is the opposite affordance and deliberately looks unlike a frame:
2px dashed var(--pico-muted-border-color), border-radius: 12px. The
dashed border invites a drop; it marks an empty slot. One tool switches from the dashed zone
to the plot frame the moment an image is loaded.
The privacy badge
Live
Everything stays in your browser. Nothing is uploaded.
<p class="tool-shield">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0" aria-hidden="true">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
</svg>
Everything stays in your browser. Nothing is uploaded.
</p>
The shield glyph is part of the badge. The class is an inline-flex with a gap
and expects the icon as its first child. The shield is the one icon missing from
icons.js. It sits inline in every tool that carries the badge. That is a small
inconsistency in this repo, not a convention.
The badge has one fixed place: no inline margin, directly below the description text, above everything else. In an earlier phase it sat next to whatever triggered it: over the drop zone in one tool, over the salary fields in another, over the microphone button in a third. Each placement was defensible on its own. Together they were incoherent.
The badge is reserved for genuinely sensitive personal data: a due date, medication, a voice recording, a salary. It had spread to five tools that merely accepted an image file. The spread was called inflationary, and the badge was removed from all five on the same day. A reassurance on every page reassures nobody.
The category accordion
The landing page groups its entries in native <details> elements, with no
JavaScript at all. The accordion is the browser's own disclosure, restyled. Each group is a
card. The native marker and Pico's own chevron are both removed. A custom chevron sits on
the left of the summary. A marker at the far right of a full-width card loses its
connection to the label. The group id doubles as the deep-link anchor.
<details class="tool-group" id="3d-modelling">
<summary>
<span class="tool-group-icon" style="--icon:url('/assets/img/icons/box.svg')" aria-hidden="true"></span>
<span class="tool-group-label">3D Modeling <span class="tool-group-count">(3)</span></span>
</summary>
<ul class="tool-list">
<li><span class="tool-icon" style="--icon:url('icons/mountain.svg')"></span>
<span class="tool-text"><a href="…">Heightmap to STL</a>
<span class="tool-desc">…</span></span></li>
</ul>
</details>
The sample above is abridged. The real summary also carries a copy-the-permalink button that appears on hover. A search field above the list filters the whole list live.
The group icons are SVG masks, not <img> elements. An
--icon variable supplies each mask, and the mask is tinted like text. The icons
therefore follow the theme the way text does, the same idea as currentColor in
the button icons.
5. Layout and width
Wordmark, content and footer line up on one vertical edge, left and right. The alignment is not automatic. Each page has to keep it. Eleven pages here were misaligned until a script checked it.
Pico steps .container at 510 / 700 / 950 / 1200 / 1450 px, switching at
576 / 768 / 1024 / 1280 / 1536 px of window width. A page that renders into a plain
.container gets the same step for header, content and footer for free. Most
pages here do that, and none of them has ever had an alignment problem.
A page that sets its own width has to cap the header and footer at the same width. Otherwise the wordmark lands inside the content edge at some window widths and outside it at others. Two shapes exist here:
/* wrapper with padding:16px around an inner box of max-width:N */
header.container, body > footer.container { max-width: calc(N + 32px); padding: 0 16px; }
/* root IS a .container with an inline maxWidth:N */
header.container, body > footer.container { max-width: Npx; }
@media (min-width: 576px) and (max-width: calc(N + 55px)) {
.container { padding-left: 16px; padding-right: 16px; } /* Pico drops it, assuming narrower steps */
}
Prose pages like this one are a single 70 ch column. A one-line navigation does not fit next to the wordmark inside 70 ch. Their header is therefore two rows at every width. The two rows are deliberate; they are no fallback for narrow windows.
Scoping rules that touch the header
custom.css serves three page families. They share a header, and each family
shrinks it differently. Every header or nav rule therefore hangs on a family hook:
ul.site-crumbs for the tool pages, ul.site-links for the content
pages, body.prose-page for everything that is not a tool. A rule meant for one family
but written on a bare header nav inevitably hits the other two. A single
header nav a { white-space: nowrap } stopped the breadcrumbs from shortening,
and every tool page overflowed sideways.
6. Copy, language and privacy
- English by default, bilingual only where a German audience needs it. English copy uses American spelling. On bilingual pages every visible string lives in one
STRINGS = { de: {…}, en: {…} }object at the top. The language choice lives inlocalStorageand is honored from?lang=. Switching happens live, without a reload. Anything derived from the strings table has to be rebuilt on a switch as well. Twice, a missed rebuild left a switch silently half-working. - German titles are real compounds, not hyphenated hybrids with an English second half. A long compound is still the right title.
- The house voice is plain. Every sentence a visitor reads answers one of three questions: what happens, what to do, or what a number means. One idea per sentence, the concrete subject first (the slider, the brush, the enemy), then the verb. Controls are named by their label, in quotes. A metaphor arrives after the thing it pictures, and a pronoun points at the nearest noun. The consequence for the visitor comes first; the mechanism follows, briefly, when it helps. Folds stay around 150 words and open with bold lead words where they cover several things, so a reader can jump. Numbers, units, sources and honest quantification ("about 62 %, depending on who you count") stay, because they are the content. Grammar yields to comprehension: a fragment, a repeated noun or a colon is fine when the sentence lands on first reading. Two pages, the galactic futures and the ruler titles, state absurd facts in the same plain voice; the wit is in the facts.
- Uncertainty goes into the band, not into the model. Studies contradict each other, and their precision does not get imported. A broader prior beats a more complex model. Single-study coefficients do not get carried to the decimal. Where two readings are defensible and both are cheap to compute, the tool offers both. It still sets a default on purpose.
- Privacy is a constraint, not a feature. No cookies, no tracking, no analytics, no external font or script requests, nothing loaded from a third party, every dependency hosted locally. There is no cookie banner, because there is nothing to consent to.
A tool's own source note is small and quiet (11 px, --tool-note). Where a brand
is named, a disclaimer sits below the note, quieter still (10 px, --tool-faint).
7. The mistakes that cost the most time
Each of these was a real bug or a real rewrite. These failure modes recur, especially when work goes fast.
- Rebuilding a component that already exists. Eighteen button sizes, nine identical rule bodies under nine names, seventeen hand-rolled segmented rows. Each started as a reasonable local decision.
- Naming a class in a comment and never defining it. The seventeen hand-rolled rows came from exactly this.
- Joining segments with
border-right: none. The shorthand resets the color too. Eleven tools drew one edge in the wrong color. - A string
stylein an htm template. Blank page, one minified error number, no other clue. - Hex literals for grays. A hex gray looks right in the theme it was written in and wrong in the other two. Nobody notices until someone switches.
- Emoji in buttons. Four different pictures on four platforms, ignoring hover and the disabled state.
- A stack of bordered panels where one card belongs.
- Per-page copies of a switcher, a footer or a header script. A later fix does not reach the copies. Centralizing them took a day. Finding the copies that had already drifted took longer.
- Winning a specificity fight by luck. Some rules apply only because the page's own
<style>comes later in the document. Such a rule stops applying the day someone reorders the files. - Trusting a green test that never ran the branch. See the htm scenario table above. A passing comparison of the wrong state looks exactly like a passing comparison of the right one.
This page describes the state of the site in August 2026. The authority for any value is
custom.css, which carries the reasoning next to the code.