rgb_to_hex: Convert RGB colour channels to hex colour codes.

View source: R/color-spaces.R

rgb_to_hexR Documentation

Convert RGB colour channels to hex colour codes.

Description

Convert RGB colour channels to hex colour codes.

Usage

rgb_to_hex(rgb)

Arguments

rgb

A dataframe or matrix with red, green and blue colour channels located in the columns 1 to 3, respectively. Colour channel values should be between 0 and 255, inclusive.

Value

A character vector with hex representations of RGB colour channels.

Examples

red <- sample(x = 1:255, size = 10, replace = TRUE)
green <- sample(x = 1:255, size = 10, replace = TRUE)
blue <- sample(x = 1:255, size = 10, replace = TRUE)
rgb_to_hex(data.frame(r = red, g = green, b = blue))

schemr documentation built on June 25, 2024, 9:07 a.m.