rgba_to_hex: rgba_to_hex

Description Usage Arguments Value Examples

View source: R/rgba_to_hex.R

Description

rgba_to_hex

Usage

1
rgba_to_hex(colour_rgba, background_colour = "#ffffff", ...)

Arguments

colour_rgba

A vector of length 4: c(red value, green value, blue value, alpha). All colour values must be between 0 and 255. Alpha must be between 0 and 1.

background_colour

Defaults to white. Users can specify a different colour to get the hex code for their original colour blended with a specified background colour. background_colour must either be a recognised colour name (e.g. "white"), a hex colour code (e.g. "#ffffff") or vector of length 3 (red value, green value, blue value), with all values between 0 and 255. The default value is white ("#ffffff").

...

Allows for US spelling of color/colour.

Value

Returns the corresponding hex colour code

Examples

1
2
3
4
5
rgba_to_hex(c(52, 46, 39, 0.8))

rgba_to_hex(c(52, 46, 39, 0.8), "blue")

rgba_to_hex(c(52, 46, 39, 0.8), "#032cfc")

monochromeR documentation built on Dec. 20, 2021, 5:07 p.m.