Colour Blindness Simulation - See Your Palette as Others Do
Colour blindness simulation re-renders a colour as someone with a colour vision deficiency would perceive it. Protanopia and deuteranopia (red-green weakness) affect roughly 8% of men; tritanopia (blue) is rare; achromatopsia is total absence of colour.
Why it matters
Around one in twelve men cannot reliably tell red from green. A red "error" chip next to a green "success" chip can look identical to them. Simulation lets you catch that before shipping.
The honest limitation: treat it as a smell test, not a verdict. The models are approximations of a spectrum of real conditions, and the actual rule that protects users is never to encode meaning in hue alone. Pair colour with an icon, a label or a pattern.
How it works
Colour blindness happens because the eye is missing or malfunctioning one of three types of cone cell. Each type is sensitive to a different part of the spectrum. The simulation models this by applying a physiological transformation matrix.
The pipeline is:
- Convert RGB to linear RGB (undo the sRGB gamma curve)
- Apply a matrix that models the missing or altered cone response
- Convert back to sRGB
The matrices come from Machado et al. (2009), which fitted lab data on real people with colour vision deficiencies. Each type of deficiency has its own matrix:
- Protanopia (no red cones; ~1% of males): red and yellow shift towards brown and grey
- Deuteranopia (no green cones; ~1% of males): green and red shift; similar effect to protanopia but slightly different
- Tritanopia (no blue cones; ~0.001% of the population): blue becomes pink, yellow becomes grey
- Achromatopsia (no colour at all; extremely rare): the world is greyscale
The matrices preserve neutral greys and white, which is why they stay relatively unaffected under simulation.
What does not matter
A simulation is not a person. Severity varies widely among people with the same deficiency type. Some people have partial colour blindness; others have it in only one eye. The models are a reasonable approximation for the most common forms, but they cannot capture every individual's experience.
Code example
Compositing a simulated colour for protanopia:
// Simplified matrix for protanopia (full version is more precise)
// This converts linear RGB to what a protanope perceives
const sRGBToLinear = (value) => {
value = value / 255;
return value <= 0.04045 ? value / 12.92 : Math.pow((value + 0.055) / 1.055, 2.4);
};
const linearToSRGB = (value) => {
value = value <= 0.0031308 ? 12.92 * value : 1.055 * Math.pow(value, 1 / 2.4) - 0.055;
return Math.round(value * 255);
};
// Protanopia matrix (red cone deficiency)
const protanopiaMatrix = [
[0.567, 0.433, 0],
[0.558, 0.442, 0],
[0, 0.242, 0.758],
];
const applyProtanopiaSimulation = (r, g, b) => {
// Convert to linear
const lr = sRGBToLinear(r);
const lg = sRGBToLinear(g);
const lb = sRGBToLinear(b);
// Apply matrix
const sr = protanopiaMatrix[0][0] * lr + protanopiaMatrix[0][1] * lg + protanopiaMatrix[0][2] * lb;
const sg = protanopiaMatrix[1][0] * lr + protanopiaMatrix[1][1] * lg + protanopiaMatrix[1][2] * lb;
const sb = protanopiaMatrix[2][0] * lr + protanopiaMatrix[2][1] * lg + protanopiaMatrix[2][2] * lb;
// Convert back to sRGB
return [
linearToSRGB(sr),
linearToSRGB(sg),
linearToSRGB(sb),
];
};
const original = [255, 0, 0]; // Pure red
const simulated = applyProtanopiaSimulation(...original);
// Result is roughly [255, 128, 128] – pale pink/salmon, not red
Wrong – applying simulation without a matrix:
// Simply desaturating or shifting hue is not a real simulation
// It will not match how a protanope actually sees the colour
const naiveDesaturate = (r, g, b) => {
const grey = (r + g + b) / 3;
return [grey, grey, grey]; // Wrong; protanopes still see colour
};
How Scalpel Color shows it
The Palette tab includes a colour-blindness preview dropdown. Select protanopia, deuteranopia, tritanopia, or achromatopsia to see each swatch re-rendered as someone with that deficiency would perceive it. The simulation happens in-browser using the Machado matrices.
If two swatches look identical after selecting protanopia, they probably fail for protanopes in real use. That is the smell test: if the simulation flags a pair as risky, pair that colour with a non-colour cue (an icon, a label, a pattern) to make them distinct even when hue is off the table.