Skip to content

Files

Latest commit

Jun 16, 2016
4e82bab · Jun 16, 2016

History

History
36 lines (25 loc) · 1.57 KB

README.md

File metadata and controls

36 lines (25 loc) · 1.57 KB

matrix-to-color

NPM version build status David deps npm download

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 and max 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)

License

MIT