matrix-to-color
v1.0.1
Published
Create an image with pixel colors based on the values of a matrix
Downloads
4
Readme
matrix-to-color
Create an image with pixel colors based on the values of a matrix
API
matrixToColor(matrix, options)
Returns a Uint8ClampedArray
with the image data.
Options
Most options are passed directly to the chroma.js library. See chroma.js docs
- mode: color mode used for interpolation (default:
'lab'
) - colors: array of color steps. Must contain at least two colors (default:
['white', 'black']
) - domain: array of value steps. Must be sorted in ascending order and contain at least two values. You can place the special values
min
andmax
at the extremities to use the min/max value of the matrix (default:['min', 'max']
) - classes: if > 0, only this number of colors will be used (default:
0
)