DEV Community

Discussion on: Exploring Color Math Through Color Blindness

Collapse
 
nburrus profile image
Nicolas Burrus

Hi! Someone told me about your post (nicely detailed!) and I have a couple comments:

1) These matrix filters are actually all meant to be applied in the linearRGB space. Unfortunately many opensource implementations got this wrong, but you cannot convert from sRGB to LMS with a single matrix multiplication. So the color-interpolation-filters setting should actually be "linearRGB" and not "sRGB". As an easy way to check whether it's correct, the pure red conversion for protanopia becomes way too dark without it.

2) For tritanopia there is no single matrix that will just work. The only approach I know that works reasonably well is the Brettel, Viénot & Mollon paper from 1997 Computerized simulation of color appearance for dichromats. It is not much more complex (two matrix multiplications and a dot product to check which one), but I'm not sure that it can still be implemented as an SVG filter.

One good reference to see how simulated images should look like is Vischeck, but unfortunately the online simulator does not work anymore. However that same code made it into GIMP as a display filter, so it's easy to test.

Another good reference is the Color Blindness Simulation Research post from ixora.io.

Otherwise I recently wrote a Review of Open Source Color Blindness Simulations that discusses the various approaches and also this more detailed article Understanding LMS-based Color Blindness Simulations
that includes a discussion about sRGB vs linearRGB.

Collapse
 
ndesmic profile image
ndesmic

Thanks so much for posting this! This is really great information and I'm really happy to receive feedback about how I can improve.

Collapse
 
nburrus profile image
Nicolas Burrus

glad if I can help! Btw it turns out that the Chrome dev tools had the same issue with sRGB, which was wrongly the default for color-interpolation-filters in the Blink renderer. They now fixed it: bugs.chromium.org/p/chromium/issue... .