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(
hue,
chroma,
luminance,
name,
limits,
oob,
labels,
)Parameters
| Parameter | Default | Description |
|---|---|---|
hue |
Pair (start, end) of hue angles. |
|
chroma |
Chroma in [0, 100]. |
|
luminance |
Luminance in [0, 100]. |
|
name |
Legend title. Overrides any name set via labels when both are present. |
|
limits |
Array of level names controlling order and inclusion, or none. |
|
oob |
Out-of-range policy: "drop" (default) removes rows whose value falls outside limits; "squish" clamps continuous values to the nearest endpoint. |
|
labels |
Array of legend labels aligned with limits, or auto. |
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,
)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,
)