Studio Tools · open-source library · MIT

Hairline

Thirty-three isometric line figures that answer the pointer. For React and for anything with a DOM.

33figures, one function each
0dependencies, ESM only
v0.5.1on npm, TypeScript
3.1kstars on GitHub
Terrain

Use it

Anything with a DOM

A figure draws into the element you give it, at that element’s width and a 5:4 aspect ratio. update changes options on the running figure; destroy removes what the figure added. That is the shape of a Svelte action, so use:terrain works as it is.

React

Every component takes the same options and every <div> attribute, and forwards its ref. On the server it renders an empty 5:4 box, so nothing shifts when it draws.

Five options, the same on every figure

OptionTypeDefault
intensitynumber0.5How strongly the figure answers the pointer, from 0 (subtle) to 1 (strong).
theme"auto" | "light" | "dark""auto"Auto follows the page: an ancestor with class dark or data-theme="dark", then the page’s color-scheme.
labelstringEnglishThe accessible name.
onRead(text) => voidThe figure’s caption each time it changes, such as "03" or "gap 28.0". The corner read-outs on this page come from it.
playbooleanfalseWalks the figure through its answer on its own, until the pointer or focus arrives. The tours on this page are this option.

Theme with six custom properties

The palette buttons above set these on the page. The figure’s styles have no specificity, so any rule of yours wins. Plates are filled, not transparent, so --hairline-plate must match the background behind the figure.

.figures {
  --hairline-plate: #101014;  /* the fill of every plate */
  --hairline-hi: #fafafa;     /* what is lit */
  --hairline-edge: #a1a1aa;   /* silhouettes */
  --hairline-mid: #52525b;    /* every other stroke */
  --hairline-lo: #27272a;     /* what recedes */
  --hairline-stroke: 0.9;     /* stroke width, in CSS px at any size */
}

How it behaves

Make your own

The repository also ships two skills for coding agents. /hairline-create a sales funnel offers concepts, draws the one you pick on the same engine, checks it against Hairline’s ten rules, and hands over one HTML file with no dependencies. /hairline-adopt icons/deploy.svg rebuilds an SVG icon or logo as a figure and proposes what the pointer does to it. See what both skills drew and how Hairline was made.

The figures on this page are mounted by a JavaScript module. If you can read this line for more than a moment, the module did not run in this browser.