This function creates a random color palette, or allows the user to select a pre-implemented palette.
colorPalette(
name,
n = NULL
)
name of the color palette. Can be random
for random colors, complement
for complementing colors, divergent
for equally spaced colors, or random-palette
for a random palette, but can also be the name of a pre-implemented palette. See the details
section for a list of pre-implemented palettes.
the number of colors to select from the palette. Required if name = 'random'
, name = 'complement'
, or name = 'divergent'
. Otherwise, if NULL
, automatically selects all colors from the chosen palette.
A vector of colors.
The following color palettes are implemented:
colorPalette("divergent", 5)
#> [1] "#57D2A1" "#4B3EC9" "#B92A64" "#9CA53C" "#52C595"