@hexorialstudio/color-blinder
Version:
Color Blinder Simulate color blindness of the given valid color hex code
91 lines (58 loc) • 1.99 kB
Markdown
# Color Blinder
Color Blinder is the Color Blinder Functions to convert the any valid color hex to a color blindness hex color.
## Getting Started
Install the module with: `npm install @hexorialstudio/color-blinder`
## Documentation
```javascript
const blinder = require('@hexorialstudio/color-blinder');
```
All the blinder functions accept 1 parameter:
- **ColorHexString** - any valid color hex string
### blinder.protanomaly(hexCode)
Part of the "Anomalous Trichromat" family of color blindness. The viewer sees low amounts of red.
```javascript
blinder.protanomaly("#ff00f7");
// result: "#9058fc"
```
#### blinder.protanopia(hexCode)
Part of the "Dichromat" family of color blindness. The viewer sees no red.
```javascript
blinder.protanopia("#ff00f7");
// result: "#518bff"
```
#### blinder.deuteranomaly(hexCode)
Part of the "Anomalous Trichromat" family of color blindness. The viewer sees low amounts of green.
```javascript
blinder.deuteranomaly("#ff00f7");
// result: "#9c5ae6"
```
#### blinder.deuteranopia(hexCode)
Part of the "Dichromat" family of color blindness. The viewer sees no green.
```javascript
blinder.deuteranopia("#ff00f7");
// result: "#638edd"
```
#### blinder.tritanomaly(hexCode)
Part of the "Anomalous Trichromat" family of color blindness. The viewer sees low amounts of blue.
```javascript
blinder.tritanomaly("#ff00f7");
// result: "#f43e9c"
```
#### blinder.tritanopia(hexCode)
Part of the "Dichromat" family of color blindness. The viewer sees no blue.
```javascript
blinder.tritanopia("#ff00f7");
// result: "#ee6168"
```
#### blinder.achromatomaly(hexCode)
Part of the "Monochromat" family of color blindness. The viewer sees the absence of most color.
```javascript
blinder.achromatomaly("#ff00f7");
// result: "#8a2d87"
```
#### blinder.achromatopsia(hexCode)
Part of the "Monochromat" family of color blindness. The viewer sees no color at all.
```javascript
blinder.achromatopsia("#ff00f7");
// result: "#484848"
```