Version Color Algorithm
The little pill in the footer that shows the current version of this site — you're looking at Version 0.3.2 — gets its background color computed from the version number itself. Every release ships with a unique color. Bumping the patch nudges the hue; bumping the major sends it somewhere else entirely.
Where the Idea Came From
Scott Klein and Claude Opus 4.7 were polishing the site footer late one evening when Scott asked: "can the color be a mathematical algorithm based on the version number?" Specifically, the suggestion was to treat the three parts of a semantic version like a tuple, do some math on them, and use the results as the three bytes of an RGB hex code. It seemed worth trying.
The Algorithm
Given a semver string like 1.2.3, split it into three integers — the
major, minor, and patch. Each of the three
RGB channels is then computed by mixing all three numbers (with different prime-weighted
contributions) through a modular formula, biased into the range [120, 240] so the
result stays paper-friendly and the text on top stays readable.
function versionColor(v) {
const [maj, min, patch] = v.split('.').map(Number);
const channel = (n, offset) => 120 + ((n * 97 + offset) % 121);
const r = channel(maj * 7 + min + patch * 3, 11);
const g = channel(min * 7 + patch + maj * 3, 47);
const b = channel(patch * 7 + maj + min * 3, 83);
return '#' + [r, g, b].map(x => x.toString(16).padStart(2, '0')).join('');
} The three multiplier sets ensure every RGB channel responds to every part of the version, so even a patch bump shifts the hue across all three channels rather than just one. The prime constants are arbitrary, picked for varied distribution rather than any deeper significance.
A small luminance check on top decides whether the pill text should be black or white, so the label stays readable regardless of where the algorithm lands.
A Few Examples
#b48f9c #e47883 #ccc2b4 #84aa85 #b493e5 #85b5d1 #cdd8b3 #b7afd1 #9e909b #938fe9 #cd9a83 #d6a8a3 At Build Time
Every build bakes in the right color for whatever version was current when the site was last
built. Bump package.json, rebuild, and the footer pill repaints itself.