autumnplot-gl

Hardware-accelerated geospatial data plotting in the browser


Project maintained by tsupinie Hosted on GitHub Pages — Theme by mattgraham

autumnplot-glDocs


autumnplot-gl / ColorMap

Class: ColorMap

A mapping from values to colors

Constructors

new ColorMap()

new ColorMap(levels, colors, opts?): ColorMap

Create a color map

Parameters

levels: number[]

The list of levels. The number of levels should always be one more than the number of colors.

colors: string[] | Color[]

A list of colors

opts?: ColorMapOptions

Options for the color map

Returns

ColorMap

Source

Colormap.ts:37

Properties

colors

readonly colors: Color[]

Source

Colormap.ts:27


levels

readonly levels: number[]

Source

Colormap.ts:26


overflow_color

readonly overflow_color: null | Color

Source

Colormap.ts:28


underflow_color

readonly underflow_color: null | Color

Source

Colormap.ts:29

Methods

getColors()

getColors(): string[]

Returns

string[]

an array of hex color strings

Source

Colormap.ts:55


getOpacities()

getOpacities(): number[]

Returns

number[]

an array of opacities, one for each color in the color map

Source

Colormap.ts:62


withOpacity()

withOpacity(func): ColorMap

Make a new color map with different opacities. The opacities are set by func.

Parameters

func

A function which takes the two levels associated with a color (an upper and lower bound) and returns an opacity in the range from 0 to 1.

Returns

ColorMap

A new color map

Source

Colormap.ts:71


diverging()

static diverging(color1, color2, level_min, level_max, n_colors): ColorMap

Create a diverging color map using two input colors

Parameters

color1: string

The color corresponding to the lowest value in the color map

color2: string

The color corresponding to the highest value in the color map

level_min: number

The lowest value in the color map

level_max: number

The highest value in the color map

n_colors: number

The number of colors to use

Returns

ColorMap

a Colormap object

Source

Colormap.ts:117