This function creates a random color palette, or allows the user to select a pre-implemented palette.

colorPalette(
  name,
  n = NULL
)

Arguments

name

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.

n

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.

Value

A vector of colors.

Details

The following color palettes are implemented:

colors

Author

Koen Derks, koen-derks@hotmail.com

Examples

colorPalette("divergent", 5)
#> [1] "#57D2A1" "#4B3EC9" "#B92A64" "#9CA53C" "#52C595"