voidcolor
v1.0.3
Published
Provides functions to convert normal colors to the colors that individuals with various types of colorblindness might see.
Downloads
6
Maintainers
Readme
Voidcolor is a Node.js package created for simulating various color blindness types.
Usage:
Install package
npm install --save voidcolor
Import package
const voidcolor = require('voidcolor');
Anopia
Simulate complete color blindness
let r = 255, g = 50, b = 0;
voidcolor.deuteranopia(r, g, b);
voidcolor.protanopia(r, g, b);
voidcolor.tritanopia(r, g, b);
voidcolor.achromatopsia(r, g, b);
Anomaly
Simulate partial color blindness
0 - normal vision, 1 - complete color blindness
let r = 255, g = 50, b = 0;
let severity = 0.5;
voidcolor.deuteranomaly(r, g, b, severity);
voidcolor.protanomaly(r, g, b, severity);
voidcolor.tritanomaly(r, g, b, severity);
Note: the return is always {r, g, b} object
Example code
const voidcolor = require('voidcolor');
const color = voidcolor.deuteranopia(230, 10, 10);
console.log(color.r);
console.log(color.g);
console.log(color.b);
Colors generated using voidcolor
Anomaly severity set at 50%