| hcl2col | R Documentation |
Convert an HCL color matrix to vector of R hex colors
hcl2col(
x = NULL,
H = NULL,
C = NULL,
L = NULL,
ceiling = 255,
maxColorValue = 255,
alpha = NULL,
fixup = TRUE,
model = getOption("jam.model", c("hcl", "polarLUV", "polarLAB")),
verbose = FALSE,
...
)
x |
matrix of colors, with rownames |
H, C, L |
numeric vectors supplied as an alternative to |
ceiling |
numeric value indicating the maximum values allowed for
|
maxColorValue |
numeric value indicating the maximum RGB values, typically scaling values to a range of 0 to 255, from the default returned range of 0 to 1. In general, this value should not be modified. |
alpha |
optional vector of alpha values. If not supplied, and if
|
fixup |
boolean indicating whether to use
|
model |
|
verbose |
|
... |
other arguments are ignored. |
This function takes an HCL matrix,and converts to an R color using
the colorspace package colorspace::polarLUV() and colorspace::hex().
When model="hcl" this function uses farver::encode_colour()
and bypasses colorspace. In future the colorspace dependency
will likely be removed in favor of using farver. In any event,
model="hcl" is equivalent to using model="polarLUV" and
fixup=TRUE, except that it should be much faster.
vector of R colors, or where the input was NA, then NA values are returned in the same order.
Other jam color functions:
alpha2col(),
applyCLrange(),
col2alpha(),
col2hcl(),
col2hsl(),
col2hsv(),
color2gradient(),
fixYellow(),
fixYellowHue(),
getColorRamp(),
hsl2col(),
hsv2col(),
isColor(),
kable_coloring(),
makeColorDarker(),
rainbow2(),
rgb2col(),
setCLranges(),
setTextContrastColor(),
showColors(),
unalpha(),
warpRamp()
# Prepare a basic HCL matrix
hclM <- col2hcl(c(red="red",
blue="blue",
yellow="yellow",
orange="#FFAA0066"));
hclM;
# Now convert back to R hex colors
colorV <- hcl2col(hclM);
colorV;
showColors(colorV);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.