scale-colour-hue

Discrete equally-spaced hue colour scale.

Steps n hues across the angular range hue in OKLCh space, picking chroma and luminance from chroma and luminance. Defaults to hue: (15deg, 375deg), chroma: 100, luminance: 65.

OKLCh is used as a perceptually uniform near-equivalent of HCL, which Typst does not expose directly. The first colour sits at hue.at(0) and successive colours step by (end - start) / n, so the endpoint is excluded and the wheel never duplicates a hue when start and end differ by a full turn.

Usage

scale-colour-hue(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Default hue wheel mapping four levels to evenly-spaced colours.

#let d = (
  (x: 1, y: 2, sp: "a"),
  (x: 2, y: 4, sp: "b"),
  (x: 3, y: 3, sp: "c"),
  (x: 4, y: 5, sp: "d"),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "sp"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-hue(),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of four points where sp maps to evenly-spaced hues stepped around the OKLCh colour wheel at full chroma and medium luminance.

Scatter chart of four points where sp maps to evenly-spaced hues stepped around the OKLCh colour wheel at full chroma and medium luminance.

Lower chroma and luminance yield a muted, pastel-like palette.

#let d = (
  (x: 1, y: 2, sp: "a"),
  (x: 2, y: 4, sp: "b"),
  (x: 3, y: 3, sp: "c"),
  (x: 4, y: 5, sp: "d"),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "sp"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-hue(chroma: 50, luminance: 80),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of four points where sp maps to evenly-spaced muted pastel hues from the OKLCh wheel at chroma 50 and luminance 80.

Scatter chart of four points where sp maps to evenly-spaced muted pastel hues from the OKLCh wheel at chroma 50 and luminance 80.

See also

scale-fill-hue, scale-colour-discrete.

Back to top