How Color Vision Deficiency Simulation Works
Cone types, confusion lines, linear-light conversion, and the Viénot 1999 projection matrices used to simulate dichromatic vision in the browser.
Primary Browser Tool
Color Blindness Simulator
Preview how an image or design looks with protanopia, deuteranopia, tritanopia, and achromatopsia.
Three Cone Types and What Happens When One Is Missing
Typical human color vision relies on three kinds of cone cells, most sensitive to long (L), medium (M), and short (S) wavelengths, loosely red, green, and blue. The brain compares their signals to tell colors apart.
In dichromacy one cone type is absent. Protanopia lacks L cones, deuteranopia lacks M cones, and tritanopia lacks S cones. Any two colors that differ only in the signal the missing cone would have produced become indistinguishable. Plotted in color space, such colors lie along straight “confusion lines”. Simulation works by collapsing each confusion line onto a single color that a person with typical vision can see.
The Calculation, Step by Step
The method used here follows Viénot, Brettel, and Mollon (1999), in the sRGB-ready matrix form published by the DaltonLens project.
- Linearize: stored sRGB values are gamma-encoded. Each channel is converted to linear light first, because cone responses add linearly with light, not with encoded values.
- Project: the linear RGB triple is multiplied by a 3×3 matrix. Conceptually this converts to cone (LMS) space, replaces the missing cone’s signal with a combination of the other two, and converts back, all folded into one matrix.
- Re-encode: the result is clamped to the displayable range and converted back to sRGB.
Why Linear Light and Which Matrices
Skipping the linearization step is a common shortcut and produces simulations that are too dark and too saturated. A mid-gray of 128 in sRGB is about 22% of maximum light, not 50%, so arithmetic on the encoded values weights dark colors incorrectly.
For protanopia and deuteranopia the single-matrix Viénot method agrees closely with the more elaborate two-plane method of Brettel et al. (1997). For tritanopia a single matrix is a rougher fit, since tritan confusion requires two half-planes to model well; the result here should be read as indicative. Achromatopsia is modeled as luminance only, using the Rec. 709 weights of 0.2126, 0.7152, and 0.0722 applied in linear light.
| Type | Missing cone | Typical confusions |
|---|---|---|
| Protanopia | L (long) | Red with green and brown; reds appear dark |
| Deuteranopia | M (medium) | Red with green and brown; brightness roughly preserved |
| Tritanopia | S (short) | Blue with green; yellow with pink or gray |
| Achromatopsia | All cone color signals | All hues; only lightness remains |
Practical Examples
Pure red under protanopia
sRGB red (255, 0, 0) becomes a dark olive with equal red and green channels. Its brightness drops sharply because L cones, the main detectors of long-wavelength light, are absent.
Common Mistakes & Honest Limitations
Mistakes to Avoid
- Using a simple “swap or average the red and green channels” filter as a simulation. It does not follow confusion lines and misrepresents which colors merge.
Technical Limitations
- The matrices assume the image is sRGB and is shown on an sRGB-like display. Wide-gamut images without color management will simulate less accurately.