as.rgb: Convert HSL or HEX to RGB

Description Usage Arguments Details Value

Description

as.rgb() converts a value in the HSL (hue-saturation-lightness) color model or a hexadecimal code for a value in the RGB (red-green-blue) color model to a value in the RGB color model.

Usage

1
as.rgb(x)

Arguments

x

A character string or a numeric vector with 3 elements. A character string is assumed to be the hexadecimal code for a value in the RGB color model; a numeric vector is assumed to be a value in the HSL color model.

Details

If x is a character string, then it is assumed that x is a hexadecimal code ('#RRGGBB') whose substrings denote the the values of the red ('RR'), green ('GG'), and blue ('BB') beams.

If x is a numeric vector (but not an integer vector), then it is assumed that x denotes a value in the HSL color model—i.e., that the first element of x is an whole number between 0 and 359, denoting the angle of the hue on the color wheel; that the second element is a floating point number (to 2 decimal places) between 0 and 1, denoting the saturation proportion; that the third element is a floating point number (to 2 decimal places) between 0 and 1, denoting the lightness proportion.

Value

An integer vector with three elements (valued between 0 and 255) that denote the values of the red, green, and blue beams, respectively.


patrickreidy/callierr documentation built on May 24, 2019, 8:22 p.m.