Colour

The colour vocabulary an author writes and a surface resolves: hues and their tones, the ramps, the surface paints, and the CSS each becomes.

@internote/canvas-sdk46 exports
On this page

Authors write colours by name (blue, light-blue, dark-blue, neutral) or as literals (hex(0064FA), rgb(0, 100, 250)). Named colours follow the reader's light or dark theme; literals are drawn exactly as written.

To use a colour an author wrote:

  • colourCss converts it to a CSS colour for a fill or stroke.
  • blendedColourCss does the same, blending while a !cue.to colour change is under way.
  • parseColour parses it, if you need its hue and tone separately.

To give one of your attributes the language's colour type, use colourTypeSpec, or colourTypeWith to narrow or extend it.

Heatmaps and contours colour a range of values rather than a single mark. surfacePaintOf reads their colour, which may also be multicolour or temperature, and surfacePaintAt gives the paint at any point in the range.

#Functions

#Constants

#Interfaces

#Types

Last updated