klar-plugin-cvd-machado
v1.0.1
Published
klar plugin: color-vision-deficiency confusability metric for extreme anomalous trichromacy (Machado 2009, severity 0.8) — deuteranomaly, protanomaly.
Maintainers
Readme
klar-plugin-cvd-machado
A klar plugin that measures whether two colors stay distinguishable for a person with anomalous trichromacy (partial color blindness — the most common form), using the Machado, Oliveira & Fernandes (2009) model at extreme severity.
It adds two contrast types:
| --type | Deficiency |
|---|---|
| cvd-deuteranomaly | shifted M (green) cone — extreme |
| cvd-protanomaly | shifted L (red) cone — extreme |
What it measures
Each type simulates both input colors as that anomalous trichromat would see them, then returns the CIEDE2000 (ΔE₀₀) between the simulated colors:
- high → the two colors stay clearly separated (good)
- low → they collapse together / become confusable (a real accessibility problem)
Higher-is-better, integer-rounded — same polarity and rounding as klar's built-in
deltaE.
Install
npm install -g klar-cli klar-plugin-cvd-machadoklar discovers it automatically via the klar-plugin-* convention.
Usage
$ klar contrast "#d40000" "#00a000" --type cvd-deuteranomaly -q
11
$ klar plugins list # confirm the two types are registeredA common convention is to treat ΔE ≥ 11 as "still clearly distinct" — your policy to apply; the plugin returns the raw number.
About the "extreme" severity (and its caveat)
Machado's model is parameterized by a severity from 0 (normal) to 1 (dichromat).
This plugin fixes severity at 0.8 — "extreme" anomalous (near-dichromatic) —
because that's where the accessibility risk concentrates: mild anomalous trichromacy
is close to normal vision, and full dichromacy is covered by the companion
klar-plugin-cvd-brettel.
Caveat: Machado's severity is a spectral-shift parameter and only a rough proxy for how a given individual actually performs (optical-density variation means the mapping isn't monotonic). So 0.8 is labelled by what it physically is — "extreme anomalous" — not as "the average anomalous trichromat." The distribution of real-world severity is gene-driven and lumpy, not a bell curve.
Tritanomaly is intentionally excluded — it's S-cone based (different genetics, rare) and Machado models it poorly; tritan deficiency is served by the Brettel plugin.
Attribution & license
- Plugin code: MIT.
- Matrices from Machado, G. M., Oliveira, M. M., & Fernandes, L. A. F. (2009). A Physiologically-based Model for Simulation of Color Vision Deficiency. IEEE TVCG, 15(6). Matrix table, used with attribution. Applied in linear RGB (per DaltonLens).
