Skip to contents

[Deprecated]

check_colour_return_rgb() is deprecated as of monochromeR 0.3.0 and will be removed in a future version. It was designed for use inside the package. To get the red, green and blue values of a colour, use grDevices::col2rgb() instead.

Usage

check_colour_return_rgb(colour, colour_variable_name)

Arguments

colour

A recognised colour name (e.g. "white"), a hex colour code (e.g. "#ffffff") or a vector of length 3 (red value, green value, blue value), with all values between 0 and 255.

colour_variable_name

The name of the variable, for readability of error messages.

Value

A named numeric vector, c(r = , g = , b = ). An error if the colour can't be interpreted.

Before monochromeR 0.3.0, colour names and hex codes returned a one-column matrix. If you need that format, use as.matrix() on the result.

Examples

# Instead of check_colour_return_rgb("white", "my_colour"):
grDevices::col2rgb("white")
#>       [,1]
#> red    255
#> green  255
#> blue   255