Skip to contents

Retrieve colour hex values from a palette

Usage

get_colours(
  colour_names = "red",
  palette = r2dii.colours::palette_1in1000_plot
)

Arguments

colour_names

Character string or a vector of character strings with names of colours for which you want to retrieve the hex values.

palette

The dataframe from which the hex values are retrieved. It should contain columns label and hex.

Value

A vector of strings with hex codes in order specified by colour_names.

Examples

# use default palette
get_colours(c("red", "blue"))
#> [1] "#F53D3F" "#3d9bf5"

# specify which palette to use
get_colours(c("red", "green"), palette = palette_1in1000_goodbad)
#> [1] "#fa9e9f" "#CDFA9E"