The Color Vision library for Javascript is composed of two parts; a color vision daltonize.js [1, 2] and simulate.js [3, 4, 5]. These algorithms combined enable developers to target specific forms of color blindness from both sides of the spectrum.The following code is an example of using the Color Vision library to daltonize an image, exposing details to a protanope:
Color.Vision.Daltonize(image, {
type: "Protanope,
callback: function(canvas) {
document.body.appendChild(canvas);
}
});
Here are the results on an Ishihara test plate [6].
Color Blindness Simulation
Gary W. Meyer and Donald P. Greenberg [3] present an algorithm to simulate the world through the eyes of dichromats. In this example, we simulate how a protanopic (red-cone missing) individual would perceive and image:
Color.Vision.Simulate(image, {
type: "Protanope",
amount: 1.0,
callback: function(canvas) {
document.body.appendChild(canvas);
}
});
One interesting thing about this algorithm is that it can be modified to match other forms of color blindness by modulating the confusion line coordinates. At this time, there is no online color vision tests that can provide measurements of an individuals confusion line, as such, one is left to creating fanciful psychedelic customalies:
Color.Vision.Simulate(image, {
type: "Custom",
x: 0.7465,
y: 0.2535,
m: 1.273463,
yint: -0.073894,
amount: 1.0,
callback: function(canvas) {
document.body.appendChild(canvas);
}
});
You can find the entire project online.
Javascript
References
- Françoise Viénot, Hans Brettel and John D. Mollon
Digital video colourmaps for checking the legibility of displays by dichromats
Color Research and Application, 24(4): 243-252, 1999.
- Onur Fidaner, Poliang Lin and Nevran Ozguven.
Analysis of Color Blindness
- Gary W. Meyer and Donald P. Greenberg
Color-Defective Vision and Computer Graphics Displays
IEEE Computer Graphics and Applications, 8(5): 28-40, 1988.
- Vivianne C. Smith and Joel Pokorny
Spectral sensitivity of the foveal cone photopigments between 400 and 500 nm
Vision Research, 15(2): 161-171, 1975.
- Bruce Lindbloom
RGB Working Space Information
- Les Daltoniens
Le test d’Ishihara






