Skip to main content

Module paint

Module paint 

Source
Expand description

Turning a finished lattice into files: PNG for the raster sizes, SVG for the ones that scale.

Two rules hold every image here together. Sites are painted as whole blocks at an integer scale, never resampled — a brand image is the lattice, magnified, not a photograph of one — and the two colours are the site’s own (site/src/styles/global.css’s --ground and --accent, the same pair the landing page’s canvas fills with).

Enums§

Cut
How a square image is cut: left whole, or cut to the disc inscribed in it (transparent outside, for an icon that will be shown round).

Constants§

ACCENT
--accent: the lit site.
GROUND
--ground: the unlit site, and the background.

Functions§

for_each_pixel 🔒
Walks the output pixels in row-major order, handing each one the site it lands in and how much of it the disc covers (always 1.0 away from a round cut’s edge).
hex 🔒
png
Paints rect of lattice at scale pixels a site, as PNG bytes.
svg
The same picture as an SVG: one <rect> a run of lit sites, on a ground-coloured field, at one unit a site.