engine/cvd library

Colour-vision-deficiency simulation and distinctness (research theme-engine.md §6, Recommendation 6).

Protanopia and deuteranopia: Machado, Oliveira & Fernandes 2009 (severity 1.0). Tritanopia: Brettel 1997 as precomputed by libDaltonLens (Machado is not valid for tritans). All matrices apply to linear sRGB; results are clamped to 0, 1.

Enums

Cvd
Simulated dichromacy.

Constants

brettelTritan1 → const List<double>
Brettel 1997 tritanopia, half-plane where n · rgb ≥ 0.
brettelTritan2 → const List<double>
Brettel 1997 tritanopia, half-plane where n · rgb < 0.
brettelTritanNormal → const List<double>
Separating-plane normal for the Brettel tritan half-planes.
machadoDeutan → const List<double>
Machado 2009 deuteranopia, severity 1.0 (row-major, linear RGB).
machadoProtan → const List<double>
Machado 2009 protanopia, severity 1.0 (row-major, linear RGB).

Functions

cvdDeltaE(int argbA, int argbB, [Cvd? type]) → double
ΔEOK between argbA and argbB as seen under type (null = normal vision).
cvdLabs(int argb) → List<Lab>
The OKLab colours of argb under normal vision, protanopia, deuteranopia and tritanopia, in that order: precompute them once per colour when comparing many pairs (minCvdDeltaELabs).
minCvdDeltaE(int argbA, int argbB) → double
Minimum ΔEOK over normal vision, protanopia, deuteranopia and tritanopia.
minCvdDeltaELabs(List<Lab> a, List<Lab> b) → double
minCvdDeltaE from two cvdLabs lists (bit-identical results).
simulateCvd(LinRgb c, Cvd type) → LinRgb
Full-severity simulation of type on linear sRGB c.
simulateCvdArgb(int argb, Cvd type) → int
Simulates type on an ARGB colour; returns opaque quantised ARGB.