hex_to_xyz: Convert hex RGB values to XYZ space.

View source: R/color-spaces.R

hex_to_xyzR Documentation

Convert hex RGB values to XYZ space.

Description

Convert hex RGB values to XYZ space.

Usage

hex_to_xyz(hex, transformation = "sRGB", linear_func = NULL)

Arguments

hex

A character vector containing hex representations of RGB colours.

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 tibble of X, Y and Z colour space values.

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

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