Skip to content

Function: densifyColorscale() ​

ts
function densifyColorscale(scale, space, resolution?): Colorscale;

Experimental

Bake an interpolation space into a colorscale: sub-divide every segment between stops (about resolution segments over the whole 0–1 span, at least one per segment) with colors mixed in space, so plain sRGB interpolation between the new stops follows the space's curve (within about 1/255 at the default resolution). Hard steps (equal positions) stay hard. 'rgb' returns the scale unchanged.

Parameters ​

ParameterTypeDefault value
scaleColorscaleundefined
spaceColorscaleInterpolationundefined
resolutionnumber64

Returns ​

Colorscale

Released under the MIT License.