Convert colors to data.frame of color attributes
Arguments
- x
charactervector of R colors- ...
any valid criteria to subset the color
data.frame.- alpha
logicalindicating whether to retainalphatransparency in intermediate operations. Whenalpha=FALSEthen all color transparency is ignored, and colors will be returned with no transparency.- byCols
charactervector 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"containscharactervalues with hexadecimal colors including alpha. If the inputxis"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 from0to360."C"contains color chroma (aka saturation) ranging from0up to200, where typical "full saturation" is represented as values above 100."L"contains color luminance (brightness/lightness) ranging from0to100."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 from0to255."green"contains the green color channel, values range from0to255."blue"contains the blue color channel, values range from0to255.
Added by jamba::col2hsv()
"h"contains color hue as values from0to1. Note these values may not map directly to color hue obtained fromjamba::col2hcl()."s"contains color saturation with values from0to1."v"contains color vibrance (brightness/lightness) with values from0to1.
Added by jamba::col2hsl()
"hsl_h"contains color hue as values from0to1. Note these values may not map directly to color hue obtained fromjamba::col2hcl()."hsl_s"contains color saturation with values from0to100."hsl_l"contains color luminance (brightness/lightness) with values from0to100.
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()