Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Jun 16, 2016
1 parent 7fdc79c commit 4e82bab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@

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](http://gka.github.io/chroma.js/#color-scales)

* 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](./LICENSE)
Expand Down
3 changes: 2 additions & 1 deletion src/matrixToColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const minMaxMatrix = require('ml-stat').matrix.minMax;
const defaultOptions = {
mode: 'lab',
colors: ['white', 'black'],
domain: ['min', 'max']
domain: ['min', 'max'],
classes: 0
};

function matrixToColor(matrix, options) {
Expand Down

0 comments on commit 4e82bab

Please sign in to comment.