Skip to content

Voidcolor is a Node.js package created for simulating various color blindness types.

License

Notifications You must be signed in to change notification settings

stromilas/voidcolor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

voidcolor

Voidcolor is a Node.js package created for simulating various color blindness types.

npm

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% voidcolor

About

Voidcolor is a Node.js package created for simulating various color blindness types.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published