All writing

The drawings on this site have tests

The drawings on this site are code, so the site's tests check them. Every shape names a role, like skin or line, and each colour theme decides what that role looks like.

· updated

Every case study and project on this site has a small drawing on its card, like a dentist up a ladder against a giant tooth. Each one is a short list of shapes and people written in code, and it becomes an SVG inside the page when the site is built. Everyone in the drawings is built on one skeleton at one size, so they look like one cast, and every line is drawn by the same pen.

points typed into the drawing's file a curve through every point the pen pressure seeded by the points
Every line in the drawings starts as a few points. The pen's pressure rises and falls from a starting point seeded by those points, so every build draws the line the same way.

A dark theme turns drawings into negatives

This site has 3 colour themes: red, light and dark. The easy way to make a drawing follow them is to swap its colours. That works for lines, but people come out as negatives: faces go dark, hair goes white, and a black sweater turns white.

So every shape in a drawing names a role, like skin or line, and each theme decides what that role looks like:

RoleWhat uses itLight themeRed and dark themes
Lineoutlines, pen strokes, hatchingblackthe page’s text colour
Masshair, black clothes, doors, handlesblacka muted tone
Skinfaces and handsthe page’s colourlight
Featureeyesblackdark
Paperwhite objects, shirts, wallsthe page’s colourthe page’s colour

On red and dark, lines turn light, black clothes turn a muted tone, and faces stay light with dark eyes.

This drawing is in whichever theme you're reading. Switch the theme to see it change.

The checks

Two things hold them: TypeScript before the build, and the tests that run against the built site like they run against every other page. One of the tests caught this stage curtain before it was fixed:

23.9 over the top the test allows 3 the canvas, 400 by 300
The curtain was a smooth curve through 7 points, and at the corners the curve swung out past the canvas. It's drawn with straight segments now.
  • Every drawing stays inside its frame. Anything past the edge gets cut off, and nothing else on the page would show it.
  • Each drawing has one motion, and it only plays on hover, so a list of cards doesn’t all start moving at the same time.
  • 2 drawings on one page never share an id. A drawing refers to its hatching and texture by id, ids belong to the whole page, and a clash would make one drawing paint with another’s.
  • A drawing can only name a role the themes define. A part that named anything else would come out solid black on every theme.
  • A card can’t name a drawing that doesn’t exist. The build stops, so a renamed drawing can’t leave a card blank.

Some of those are tests and some are TypeScript. A role and a drawing’s name are both fixed lists in the code, so a misspelling of either one fails the build before a test gets to run. They weren’t always lists: until recently a part got its colour from a name pasted into a class, and nothing read it back.

What the checks can’t tell

Whether a drawing is any good. An LLM wrote most of the drawing code and the coordinates. I chose the style, looked at the drawings in all 3 themes and sent back the versions that didn’t work. The negatives above were found by looking at the drawings, and so were smaller problems like lines that came out frayed. That looking happens on a gallery page that shows every drawing in all 3 themes, and it only exists while the site runs on my machine.