parseSurfacePaint

Parses a surface-colour value into the colour scale a heatmap or contour draws with, or returns null if it is not a valid colour.

@internote/canvas-sdkFunction
On this page
import { parseSurfacePaint } from '@internote/canvas-sdk';

Three written forms, and the shape of the answer says which was used:

  • ONE HUE names its own scale, and expands to three stops: pale, the reading tone, deep. The commonest case, and the reason a bare hue means anything at all on a surface.
  • A LIST is the stops themselves, in the order written — red, green, pink is a three-stop gradient. Each entry is taken at its reading tone and NOT expanded, because an author writing the stops out has said where they want them; expanding each into three would put nine colours on a range they asked for three of.
  • ONE LITERAL has no scale and no neighbours, so there is no range to show in colour at all. It comes back flat, and the surface shows its range as opacity.

The ramp keywords multicolour and temperature are not read here; surfacePaintOf adds them.

#Signature

(value: unknown): SurfacePaint | null

#Parameters

value
A surface colour attribute value.

Declared in packages/canvas-sdk/src/paint/colour.ts:295.

Last updated