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.
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:
| Role | What uses it | Light theme | Red and dark themes |
|---|---|---|---|
| Line | outlines, pen strokes, hatching | black | the page’s text colour |
| Mass | hair, black clothes, doors, handles | black | a muted tone |
| Skin | faces and hands | the page’s colour | light |
| Feature | eyes | black | dark |
| Paper | white objects, shirts, walls | the page’s colour | the page’s colour |
On red and dark, lines turn light, black clothes turn a muted tone, and faces stay light with dark eyes.
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:
- 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.