Hardware-accelerated geospatial data plotting in the browser
autumnplot-gl • Docs
autumnplot-gl / ColorMap
A mapping from values to colors
new ColorMap(
levels
,colors
,opts
?):ColorMap
Create a color map
• 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
readonly
colors:Color
[]
readonly
levels:number
[]
readonly
overflow_color:null
|Color
readonly
underflow_color:null
|Color
getColors():
string
[]
string
[]
an array of hex color strings
getOpacities():
number
[]
number
[]
an array of opacities, one for each color in the color map
withOpacity(
func
):ColorMap
Make a new color map with different opacities. The opacities are set by func.
• 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.
A new color map
static
diverging(color1
,color2
,level_min
,level_max
,n_colors
):ColorMap
Create a diverging color map using two input colors
• 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
a Colormap object