Skip to content

Documentation / @ripl/core / scaleSequential

Function: scaleSequential()

scaleSequential(interpolator, domain?): ColorScale

Defined in: packages/core/src/color/scales.ts:89

Creates a colour scale mapping a numeric domain through a colour interpolator (or array of stops, e.g. one of the built-in COLOR_SCHEME_* palettes). Values are clamped to the domain.

  • Sequential — a two-element domain [min, max] maps linearly across the whole interpolator.
  • Diverging — a three-element domain [min, neutral, max] maps neutral to the interpolator's midpoint, so signed data reads symmetrically around a reference value.

Tick generation defers to an underlying continuous scale; formatting is left to the caller and is never bound to the scale.

Parameters

ParameterType
interpolatorColorInterpolatorInput
domainnumber[]

Returns

ColorScale