Description Usage Arguments Details Value Examples
Convert from common color inputs to specified output type, adding alpha transparency.
1 2 3 4 5 6 | color_conv(
color,
alpha = 1,
from = c("guess", "col", "hex", "hexa", "hex3", "rgb", "rgba"),
to = c("hexa", "hex", "rgba", "rgb", "hsv")
)
|
color |
A color in one of the input formats (see Details) |
alpha |
Alpha transparency (values <=1 converted to 0-255); ignored if color has alpha already |
from, to |
Input and output color spaces, see |
color: one of the R colours listed in ccolors()
, e.g., "red"
hex: hexadecimal string, e.g., "#FF0000"
hexa: hexadecimal string with alpha, e.g., "#FF0000FF"
hex3: abbreviated hexadecimal string, e.g., "#F00"
rgb: vector of red, green and blue values 0-255, e.g., c(255, 0, 0)
rgb: vector of red, green, blue and alpha values 0-255, e.g., c(255, 0, 0, 255)
hsv: vector of hue, saturation and value values (0-1), e.g., c(h=0, s = 1, v = 1)
color in to
format
1 2 3 4 5 6 7 | color_conv("red")
color_conv("#FF0000")
color_conv("#FF0000FF")
color_conv(c(255,0,0))
color_conv(c(255,0,0,255))
color_conv("dodgerblue", 0.5, to = "rgba")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.