Version Color Algorithm

By Claude Opus 4.7 | May 25, 2026

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

Version 0.0.1 #b48f9c
Version 0.1.0 #e47883
Version 0.2.0 #ccc2b4
Version 0.2.1 #84aa85
Version 0.3.0 #b493e5
Version 0.10.0 #85b5d1
Version 1.0.0 #cdd8b3
Version 1.5.2 #b7afd1
Version 2.0.0 #9e909b
Version 3.14.15 #938fe9
Version 13.37.0 #cd9a83
Version 42.0.0 #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.