Skip to content
animorio
IT
All components

Color blindness simulator

Pickers, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.5 KBGSAP 28 KBFreeDownload the zip

A design tool’s palette check in a card on white: five colours and four ways of seeing them, normal vision, protanopia, deuteranopia and tritanopia. Picking a kind of colour blindness fades the colours into the ones seen by people who have it, and under the two that end up looking alike a bracket is drawn joining them; at the top the count of the pairs that get confused, below their names.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Color blindness simulator" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Color blindness simulator</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the colour-vision check of a design tool: a palette seen with protanopia, deuteranopia or tritanopia,
         and the colours that end up looking alike joined by a bracket -->
    <section class="cv" data-cv aria-label="Palette check">
      <header class="cv__head"><strong>Palette check</strong><span class="cv__sum"><span data-outsum>All distinct</span></span></header>
      <div class="cv__seg" role="group" aria-label="Colour vision" data-seg>
        <i class="cv__pick" data-pick aria-hidden="true"></i>
        <button type="button" class="cv__opt" data-kind="normal"><span>Normal</span></button>
        <button type="button" class="cv__opt" data-kind="protan"><span>Protan</span></button>
        <button type="button" class="cv__opt" data-kind="deutan"><span>Deutan</span></button>
        <button type="button" class="cv__opt" data-kind="tritan"><span>Tritan</span></button>
      </div>
      <div class="cv__view">
        <div class="cv__row" data-row></div>
        <svg class="cv__links" data-links aria-hidden="true"></svg>
        <div class="cv__names" data-names></div>
      </div>
      <p class="cv__note"><span class="cv__clip cv__what"><span data-outwhat>Full colour vision</span></span><span class="cv__clip cv__said"><span data-outsaid>Every colour stays apart.</span></span></p>
    </section>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></svg>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

23 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Color blindness simulator” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On white, a rounded card: “Palette check” and on the right, in green, “All distinct”. Below, four options in a row, “Normal”, “Protan”, “Deutan” and “Tritan”, the active one on a white tile. Then five rounded colour swatches, red, green, blue, amber and violet, with their names underneath, and at the bottom a light grey box: “Full colour vision” and “Every colour stays apart.”. Tapping “Protan” slides the tile and the five colours fade one after the other: the red becomes an olive brown, the violet a blue. Under the green and the amber, and under the blue and the violet, two brackets are drawn joining them and the swatches answer with a small hop; at the top the text rolls into “2 pairs alike”, in amber, and the box says “Protanopia · no red cones” and “Green & Amber, Blue & Violet look alike.”. With “Deutan” it is the red that gets confused with the green; with “Tritan” the green with the blue.

How it works

The simulation is a matrix

Every colour is taken to linear RGB, multiplied by the matrix of the kind of colour blindness (those of Machado, Oliveira and Fernandes, 2009) and brought back to sRGB. Three matrices, one per kind.

The colours fade

Every swatch keeps its starting colour and its target; a single number goes from zero to one and each swatch reads it with a small delay.

Who gets confused

The distance between every pair of simulated colours is measured in Lab space: under the threshold the pair counts as confusable.

The bracket

For every pair an SVG path goes down from the middle of one swatch, runs underneath and comes up at the middle of the other, drawn with stroke-dashoffset. A second pair runs lower.

Values to change

NameFileDefaultWhat it changes
REDscript.js#d9432fThe first colour of the palette.
GREENscript.js#5f9a2aThe second colour.
BLUEscript.js#2f6fe0The third colour.
AMBERscript.js#e8a317The fourth colour.
VIOLETscript.js#8a4fd8The fifth colour.
ALIKEscript.js24Under which distance two colours count as confusable.
FADEscript.js0.6How many seconds the colours take to change.
SPRINGscript.js1How much the tile and the confused colours bounce.
LOOPscript.jstrueLeft alone, the demo’s pointer tries the three kinds of colour blindness and starts again.

Try them in the Playground

When to use it

In the colour editor of a design system, in the panel of a palette generator or in a dashboard’s chart settings, to see at once whether two series get confused; the same segmented control transforming a preview carries an interface’s themes, a photo’s lighting conditions or the versions of a brand.

On phones

The card is at most 348 pixels wide and about 270 tall, and narrows with the screen: the five swatches share the width and the brackets are redrawn on their centres. The four options are 32 pixels tall.

With reduced motion

No fades and no hops: the simulated colours, the brackets already drawn and the new texts appear at once. The demo’s pointer does not start.

Pitfalls

  • The simulation approximates how people with complete dichromacy see: the commonest forms are partial, and the distance threshold is a practical choice, not a standard. It is for finding problems, not for declaring a palette accessible.
  • The matrix has to be applied in linear RGB, not on sRGB values: skipping the conversion makes the simulated colours too dark.
  • The brackets join the swatches and the pairs’ names are written below: people who cannot tell the colours apart, exactly who matters here, read the result in words.
  • The brackets are drawn in pixels on the swatches’ centres: on resize they are redrawn.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 6.5 KB; the libraries: GSAP 28 KB.

Testing

Tested on 30 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All components