rgb2hex: Convert r,g,b,a values as string or numeric to hex

View source: R/utils_css_color.R

rgb2hexR Documentation

Convert r,g,b,a values as string or numeric to hex

Description

Convert r,g,b,a values as string or numeric to hex

Usage

rgb2hex(red, green, blue, alpha = FALSE)

Arguments

red

chr/num Either a CSS rgb() or rgba() declaration as a string, or the red value as numeric.

alpha

lgl/num Whether to include the alpha value (an 8 digit hex) in the output or not, or the alpha value to apply, If set to TRUE, and alpha is not set, an alpha value of 1 will be appended. If numeric, a value between 0 & 1 inclusive to set as the alpha value.

Value

chr The hex value

See Also

rgb2hex_

Other color: color_cycle(), color_distance(), color_luminance(), color_match(), color_rgb_table(), color_separate(), color_text_by_luminance(), colors2css(), css_col2vec(), luminance_filter()

Examples

rgb2hex("rgba(18,180,211,1)", alpha = TRUE)
rgb2hex("rgba(18,180,211,1)", alpha = FALSE)

yogat3ch/UU documentation built on May 31, 2024, 10:14 p.m.