Skip to main content

Function: sampleColormap()

sampleColormap(palette, t, useOklab): string

Defined in: src/mobjects/graphing/colormap.ts:47

Sample a color map at position t in 0..1.

t is clamped to 0..1. A palette with one stop returns that stop. Otherwise t is scaled across the stops and the two surrounding stops are blended.

Parameters​

palette​

readonly string[]

Ordered hex color stops. Must hold at least one color.

t​

number

Position along the palette, clamped to 0..1.

useOklab​

boolean = false

Blend in Oklab space for a perceptually-uniform result.

Returns​

string