as.hsl: Convert HEX or RGB to HSL

Description Usage Arguments Details Value

Description

as.hsl() converts a value in the RGB (red-green-blue) color model to one in the HSL (hue-saturation-lightness) color model. The value in the RGB color model may be specified either as a hexadecimal code or as integer levels of the red, green, and blue beams.

Usage

1
as.hsl(x)

Arguments

x

A character string or an integer vector with 3 elements. A character string is assumed to be a hexadecimal code; an integer vector is assumed to be a value in the RGB color model, whose elements are integers between 0 and 255

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 an integer vector, then it is assumed that x denotes the integer values of the red, green, and blue beams for the color.

Value

A numeric vector with three elements. The first element denotes the color's hue and is represented as a degree on the color wheel (i.e., a whole number between 0 and 359). The second element denotes the color's (proportion of) saturation to 2 decimal places (i.e., a number between 0 and 1. The third element denotes the color's (proportion of) lightness to 2 decimal places (i.e., a number between 0 and 1).


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