Generates n colours sharing base's own hue and saturation, swept
linearly through HSL lightness from lightness[1] to lightness[2]
– a monochromatic ramp from near-black, through base's own hue, to
near-white (or whatever narrower lightness range is supplied).
Usage
palette_tonal(base, n = 5L, lightness = c(0.1, 0.9))Arguments
- base
A single colour, used as the palette's shared hue and saturation.
- n
A single positive whole number: the number of colours to return.
- lightness
A length-2 numeric vector, each between 0 and 1: the HSL lightness of the first and last returned colours. Default
c(0.1, 0.9)avoids sweeping all the way to pure black/white.
See also
Other palette helpers:
palette_cosine(),
palette_gradient(),
palette_harmony(),
palette_manual(),
palette_walk()
Examples
palette_tonal("darkorchid", n = 6)
#> [1] "#1F0A29" "#501A6A" "#812AAC" "#AA53D5" "#CA95E5" "#EBD6F5"
palette_tonal("darkorchid", n = 6, lightness = c(0.3, 0.7))
#> [1] "#5C1E7B" "#75269C" "#8D2EBC" "#A243D1" "#B263D9" "#C284E1"
draw(effect_swatch(color = palette_tonal("darkorchid", n = 6)))