Skip to contents

Converts RGB values to hex colour code

Usage

rgb_to_hex(x)

Arguments

x

Red, green and blue values between 0 and 255: either a vector of length 3 (e.g. c(15, 75, 99)) or the matrix returned by rgba_to_rgb().

Value

A corresponding hex colour code

Examples

temp_rgb_matrix <- rgba_to_rgb(c(52, 46, 39, 0.8))
rgb_to_hex(temp_rgb_matrix)
#> [1] "#5C5752"

rgb_to_hex(c(15, 75, 99))
#> [1] "#0F4B63"