Convert colors to data.frame of color attributes
Arguments
- x
character
vector of R colors- ...
any valid criteria to subset the color
data.frame
.- alpha
logical
indicating whether to retainalpha
transparency in intermediate operations. Whenalpha=FALSE
then all color transparency is ignored, and colors will be returned with no transparency.- byCols
character
vector of colnames to sort after the subset operation.
Value
data.frame
with color attributes as columns.
When byCols
is defined, the data.frame
is sorted using
jamba::mixedSortDF()
.
When ...
is supplied, subset()
is applied to subset colors.
Details
This function takes a vector of colors and returns a data.frame
with relevant color attributes:
"num"
contains the integer index of the input vectorx
."hex"
containscharacter
values with hexadecimal colors including alpha. If the inputx
is"red"
then the hex value will be converted to"#FF0000FF"
."name"
ifnames(x)
is not empty
Added by jamba::col2hcl()
"H"
contains color hue as values from0
to360
."C"
contains color chroma (aka saturation) ranging from0
up to200
, where typical "full saturation" is represented as values above 100."L"
contains color luminance (brightness/lightness) ranging from0
to100
."alpha"
the alpha transparency, ranging from0
(fully transparent) to1
(fully opaque, not transparent).
Added by grDevices::col2rgb()
"red"
contains the red color channel, values range from0
to255
."green"
contains the green color channel, values range from0
to255
."blue"
contains the blue color channel, values range from0
to255
.
Added by jamba::col2hsv()
"h"
contains color hue as values from0
to1
. Note these values may not map directly to color hue obtained fromjamba::col2hcl()
."s"
contains color saturation with values from0
to1
."v"
contains color vibrance (brightness/lightness) with values from0
to1
.
Added by jamba::col2hsl()
"hsl_h"
contains color hue as values from0
to1
. Note these values may not map directly to color hue obtained fromjamba::col2hcl()
."hsl_s"
contains color saturation with values from0
to100
."hsl_l"
contains color luminance (brightness/lightness) with values from0
to100
.
See also
Other colorjam sort:
sort_colors()
,
subset_colors()
Other colorjam core:
blend_colors()
,
closestRcolor()
,
closest_named_color()
,
color_complement()
,
group2colors()
,
rainbowJam()
,
sort_colors()
,
subset_colors()