ColorMap

Methods

(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:
NameTypeDescription
nColorsnumber

integer number of colors to be returned

stopsArray

Array of nColors css colors, placed at locs below

locsArray

Array of nColors floats in [0.1]. Default to even distribution

Returns:

Returns Array of nColors rgba color arrays

Type: 
Array

(static) arrayToTypedColors(Array)

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

Parameters:
NameTypeDescription
ArrayArray

of rgba color arrays

Returns:

Array of the rgba arrays to Color.typedColors