Apply filters to colors to simulate things like color blindness and night vision.
npm install color-matrix





Apply filters to colors to simulate things like color blindness and night vision. This
library tries to simulate the behavior of the svg filter effect
feColorMatrix.
It comes in 2 formats: a node.js library and a
command line tool.
Usage and output examples can be found here:
- http://projects.skratchdot.com/color-matrix/examples.html
Install the module with: npm install color-matrix
``javascript`
var ColorMatrix = require('color-matrix').ColorMatrix;
var matrix = new ColorMatrix();
// simulate color-blindness
matrix.transform([222, 0, 173, 255], 'deuteranopia'); // returns [139, 155, 121, 1]
NOTE: For a better "color blindness" library, see:
color-blind. This library is just a port
of the old "color matrix" code for use in node. It does allow you to pass in custom
filters (which is why I published it, instead of throwing it away).
Read the API Docs
by using this link:
- http://projects.skratchdot.com/color-matrix/api.html
The color-matrix tool can be installed globally by running:`bash`
npm install -g color-matrix
`bash
Usage: color-matrix [options]
Options:
-h, --help output usage information
-V, --version output the version number
-i, --input
-o, --output
-f, --filter
-v, --value
-l, --list list all the filter names
``
- MDN: feColorMatrix
- w3c spec: feColorMatrix
- color-js source code
- Original Color Matrix Library
- StackOverflow: RGB filters for different forms of color blindness
- Fun with the colormatrix
Copyright (c) 2014 skratchdot
Licensed under the MIT license.