Colour Vision Simulator
See a palette and a red-green status chart through four types of colour vision deficiency.
AI prompt
Accessibility review sheet showing the same status dashboard in four panels: normal colour vision, protanopia, deuteranopia and tritanopia, each with green success pills, red error pills and amber warning pills, the red and green pills becoming nearly identical brown-olive in the red-green deficiency panels, labels and icons on every pill so meaning survives, flat vector style, clean grid. Negative: gradients, photos, text errors, decorative frames. Reduced motion: static sheet.About this pattern
Definition
About one in twelve men and one in two hundred women have a colour vision deficiency, most often confusing red and green. A simulator applies a colour matrix to your design so you can see which colours merge and which meanings are lost.
When to use it
- Protanopia and deuteranopia confuse reds and greens; tritanopia confuses blues and yellows; monochromacy removes hue entirely.
- Never rely on red versus green alone for status; add icons, labels or patterns.
- Check charts with several series: lines that differ only in hue can become identical.
What the controls do
- Five vision modes applied live to a palette and a status chart.
Motion & timing
- Changes are instant; there is no animation.
- Reduced motion: nothing to change.
Tips & variations
- Test with the simulator and also check text contrast; they catch different problems.
- Prefer palettes that differ in lightness as well as hue.
Code of this live preview
<svg width="0" height="0" aria-hidden="true" focusable="false"><defs><filter id="pro" color-interpolation-filters="sRGB"><feColorMatrix values="0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0"/></filter><filter id="deu" color-interpolation-filters="sRGB"><feColorMatrix values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/></filter><filter id="tri" color-interpolation-filters="sRGB"><feColorMatrix values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/></filter><filter id="mon" color-interpolation-filters="sRGB"><feColorMatrix values="0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0 0 0 1 0"/></filter></defs></svg><div class="bx"><div class="pre" id="pre" role="group" aria-label="Vision"><button data-p="0" aria-pressed="true">Normal</button><button data-p="1" aria-pressed="false">Protanopia</button><button data-p="2" aria-pressed="false">Deuteranopia</button><button data-p="3" aria-pressed="false">Tritanopia</button><button data-p="4" aria-pressed="false">Monochrome</button></div><div class="pn" id="pn"><div class="sw"><i style="background:#d7263d"></i><i style="background:#2e9e4f"></i><i style="background:#f2a900"></i><i style="background:#2b59d6"></i><i style="background:#7b4bb7"></i><i style="background:#8a8a8a"></i></div><div class="st"><span class="g">✓ Passed</span><span class="r">✗ Failed</span><span class="a">! Warning</span></div><div class="st"><span class="g">Online</span><span class="r">Offline</span></div></div><p class="out" id="out"></p></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.pn{border:1px solid var(--line);border-radius:12px;background:#fff;padding:10px;display:grid;gap:10px}.sw{display:grid;grid-template-columns:repeat(6,1fr);gap:6px}.sw i{height:30px;border-radius:6px}
.st{display:flex;gap:6px;flex-wrap:wrap}.st span{padding:4px 11px;border-radius:99px;font-size:12px;font-weight:600;color:#fff}.st .g{background:#2e9e4f}.st .r{background:#d7263d}.st .a{background:#f2a900;color:#222}
.out{font-size:12px;color:var(--muted);min-height:34px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const F=['none','url(#pro)','url(#deu)','url(#tri)','url(#mon)'],T=['Normal colour vision.','Protanopia: reds look dark and merge with greens and browns.','Deuteranopia: reds and greens look the same yellow-brown.','Tritanopia: blues and yellows are confused.','Monochromacy: only lightness remains, so hue-only meaning disappears.'],pn=document.getElementById('pn'),bs=[...document.querySelectorAll('#pre button')];let p=0;
function up(){pn.style.filter=F[p];document.getElementById('out').textContent=T[p];bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));up();One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Colour Vision Simulator — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.pn{border:1px solid var(--line);border-radius:12px;background:#fff;padding:10px;display:grid;gap:10px}.sw{display:grid;grid-template-columns:repeat(6,1fr);gap:6px}.sw i{height:30px;border-radius:6px}
.st{display:flex;gap:6px;flex-wrap:wrap}.st span{padding:4px 11px;border-radius:99px;font-size:12px;font-weight:600;color:#fff}.st .g{background:#2e9e4f}.st .r{background:#d7263d}.st .a{background:#f2a900;color:#222}
.out{font-size:12px;color:var(--muted);min-height:34px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<svg width="0" height="0" aria-hidden="true" focusable="false"><defs><filter id="pro" color-interpolation-filters="sRGB"><feColorMatrix values="0.567 0.433 0 0 0 0.558 0.442 0 0 0 0 0.242 0.758 0 0 0 0 0 1 0"/></filter><filter id="deu" color-interpolation-filters="sRGB"><feColorMatrix values="0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0"/></filter><filter id="tri" color-interpolation-filters="sRGB"><feColorMatrix values="0.95 0.05 0 0 0 0 0.433 0.567 0 0 0 0.475 0.525 0 0 0 0 0 1 0"/></filter><filter id="mon" color-interpolation-filters="sRGB"><feColorMatrix values="0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0 0 0 1 0"/></filter></defs></svg><div class="bx"><div class="pre" id="pre" role="group" aria-label="Vision"><button data-p="0" aria-pressed="true">Normal</button><button data-p="1" aria-pressed="false">Protanopia</button><button data-p="2" aria-pressed="false">Deuteranopia</button><button data-p="3" aria-pressed="false">Tritanopia</button><button data-p="4" aria-pressed="false">Monochrome</button></div><div class="pn" id="pn"><div class="sw"><i style="background:#d7263d"></i><i style="background:#2e9e4f"></i><i style="background:#f2a900"></i><i style="background:#2b59d6"></i><i style="background:#7b4bb7"></i><i style="background:#8a8a8a"></i></div><div class="st"><span class="g">✓ Passed</span><span class="r">✗ Failed</span><span class="a">! Warning</span></div><div class="st"><span class="g">Online</span><span class="r">Offline</span></div></div><p class="out" id="out"></p></div>
</div>
<script>
const F=['none','url(#pro)','url(#deu)','url(#tri)','url(#mon)'],T=['Normal colour vision.','Protanopia: reds look dark and merge with greens and browns.','Deuteranopia: reds and greens look the same yellow-brown.','Tritanopia: blues and yellows are confused.','Monochromacy: only lightness remains, so hue-only meaning disappears.'],pn=document.getElementById('pn'),bs=[...document.querySelectorAll('#pre button')];let p=0;
function up(){pn.style.filter=F[p];document.getElementById('out').textContent=T[p];bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));up();
</script>
</body></html>