parse_color: Parse colors specified in a given model

View source: R/parse_color.R

parse_colorR Documentation

Parse colors specified in a given model

Description

Parse colors specified in a given model

Usage

parse_color(x, model)

Arguments

x

a matrix or data.frame whose columns specify the color channels or a vector of color definitions for the css, hex, temperature, wavelength color models.

model

string defining the color model; valid models are rgb, rgba, ryb, hsv, hsl, hsi, hcl, lch, lab, cmyk, css, hex, temperature, wavelength.

Value

A vector of colors specified as hex codes

See Also

convert_color to convert parsed colors to another model.

Other color specifications: cmyk(), css(), hcl(), hex(), hsi(), hsl(), hsv(), lab(), rgb(), ryb(), temperature(), wavelength()

Examples

parse_color(data.frame(h=c(0, 120, 240), s=0.5, v=0.7), model="hsv")
parse_color(data.frame(r=c(255, 0, 0),
                       g=c(0, 255, 0),
                       b=c(0, 0, 255)), model="rgb")

jiho/chroma documentation built on Nov. 26, 2022, 2:39 a.m.