lab_to_hex: Convert from Lab space into hex RGB colour values.

View source: R/color-spaces.R

lab_to_hexR Documentation

Convert from Lab space into hex RGB colour values.

Description

Convert from Lab space into hex RGB colour values.

Usage

lab_to_hex(lab, transformation = "sRGB", linear_func = NULL)

Arguments

lab

A dataframe or matrix with L, a and b colour channels located in the columns 1 to 3, respectively.

transformation

An option in c("sRGB", "Adobe") for a built-in transformation or, alternatively, a custom 3x3 transformation matrix.

linear_func

A function to convert RGB colour space into non-linear RGB space. Used only if a custom transformation matrix is provided. Transformation skips if no function is provided under a user-defined transformation matrix. See: https://en.wikipedia.org/wiki/SRGB.

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)
lab_to_hex(rgb_to_lab(data.frame(r = red, g = green, b = blue)))

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