Generates n colours by taking successive random steps through RGB
space, starting at base, reflecting back into range at the [0, 1]
boundary of each channel rather than clamping – so a channel that
would overshoot bounces back instead of flattening out at the
boundary for the rest of the walk. This gives a sequence of related
but organically drifting colours, in contrast to palette_harmony()'s
fixed geometric relationships or palette_cosine()'s periodic
formula.
Arguments
- n
A single positive whole number: the number of colours to generate.
- base
NULL(the default) or a single colour to start the walk at.NULLstarts from a uniform-random colour instead.- step
A single positive number controlling the standard deviation of each channel's random step between successive colours – larger values wander further/faster.
- seed
A single whole number seeding the random walk, so the same
seedalways produces the same palette.
See also
Other palette helpers:
palette_cosine(),
palette_gradient(),
palette_harmony(),
palette_manual(),
palette_tonal()
Examples
palette_walk(n = 10, base = "seagreen", seed = 4187)
#> [1] "#2E8B57" "#018261" "#108570" "#068A78" "#01A47E" "#148A73" "#2E9B92"
#> [8] "#0CA179" "#11BE83" "#26DD81"
palette_walk(n = 10, step = 0.2, seed = 4187)
#> [1] "#04B453" "#0E9589" "#3AA1DE" "#2588B3" "#1D758F" "#1485A3" "#553D50"
#> [8] "#3433B4" "#7B28B8" "#FA0142"
draw(effect_swatch(color = palette_walk(n = 10, base = "seagreen", seed = 4187)))