Crackl’n Brook · Color mathematics you can touch

Palette Distance Explorer

One color, several coordinate systems, and several ideas of “closest.” Rotate the spaces. Move the target. Watch the matching rules disagree.

Choose a source color

Click to choose
Adjust any channel below or click the swatch.

RGB channels are encoded sRGB values (0–255). XYZ uses the standard D65 white point; Lab is relative to that same white.

Rotate the color space

Drag to orbit · Scroll to zoom · Tap a palette point to select it

TargetNearest by selected ruleOther demo palette colors

Four different answers to “closest”

Each method searches the exact same demonstration palette. Click a result to move the target there, or inspect how the winners differ.

Inside perceptual space: a* versus b*

A top-down Lab map. Horizontal = green (−a*) to red (+a*). Vertical = blue (−b*) to yellow (+b*). Lightness is *not* shown on this slice.

Background colors are an approximate sRGB display of fixed-L* Lab coordinates. Unrepresentable colors are left dark.

Why the distances change

“Find a disagreement” scans sample target colors for a case where ΔE76 and ΔE2000 choose different winners. It does not alter the palette.

Try your own palette

Optional: replace the demonstration colors with your own numbered thread entries. One per line: name,#RRGGBB. These are illustrative screen colors, not measured real-world thread spectra.

Open the mathematics

1 · Why RGB is not a uniform space

sRGB stores nonlinear, gamma-encoded channel values so its numbers relate to display hardware. Equal steps in the RGB cube are not perceived as equal differences. Euclidean RGB matching is cheap but its notion of closeness is geometric, not perceptual.

encoded sRGB → linear RGB → XYZ

Each channel is linearized with the standard sRGB transfer function, then multiplied by the standard D65 RGB→XYZ matrix. The transform assumes sRGB primaries and a D65 white point.

2 · What are X, Y, Z?

CIE XYZ is a standardized tristimulus coordinate system describing color matches for a standard observer. In XYZ, Y corresponds to luminance (up to a scale convention); X and Z are additional color-matching coordinates. XYZ is not a perceptually uniform distance space.

[X, Y, Z]ᵀ = M · [Rlin, Glin, Blin]ᵀ
3 · Why Lab looks like a human-centered geometry

CIELAB maps XYZ relative to a reference white through a nonlinear function. L* is lightness, a* roughly green↔red, b* roughly blue↔yellow. ΔE76 is ordinary 3D Euclidean distance in Lab. Its uniformity is only approximate, which motivated refinements.

ΔE76 = √[(ΔL*)² + (Δa*)² + (Δb*)²]

Chroma C* = √(a*²+b*²) and hue angle h = atan2(b*,a*) transform the a*b* plane into polar coordinates (LCh).

4 · What makes CIEDE2000 different?

CIEDE2000 modifies how differences in lightness, chroma, and hue are weighted depending on *where* the two colors lie. It also includes a rotation term, particularly relevant to some blue regions. Thus its distance isn't simply the length of the straight connecting line in a Lab plot.

That means the nearest color under ΔE2000 need not be the nearest dot in straight-line Lab geometry. The full formula is implemented here, including the neutral-chroma and hue-wrap cases.

5 · Why this isn't a calibrated thread matcher yet

A screen swatch is only a predicted display of a color. Actual embroidery floss changes appearance under lighting, fabric, texture, camera, dyes, and metamerism. A production matcher needs a properly characterized palette, consistent source color management, and ideally measurements under stated viewing conditions.