On this page

# ColorMap

Source
  - ColorMap.js, line 15

## Methods

### (static) arrayToTypedColors(Array)

Convert an Array of rgba color arrays into Array of 4 element typedColors.

Parameters:

Name | Type | Description
--- | --- | ---
`Array` | Array | of rgba color arrays

Source
  - ColorMap.js, line 86

Returns:

Array of the rgba arrays to Color.typedColors

### (static) gradientImageData(nColors, stops, locs) → {Array}

Ask the browser to use the canvas gradient feature to create nColors given the gradient color stops and locs. See Mozilla Gradient Doc,

This is a powerful browser feature, can be used to create all the MatLab colormaps.

Stops are css strings. Locs are floats from 0-1, default is equally spaced.

Parameters:

Name | Type | Description
--- | --- | ---
`nColors` | number | integer number of colors to be returned
`stops` | Array | Array of nColors css colors, placed at locs below
`locs` | Array | Array of nColors floats in [0.1]. Default to even distribution

Source
  - ColorMap.js, line 36

Returns:

Returns Array of nColors rgba color arrays

Type:
  Array

Type anything to view search result