hex | R Documentation |
Converts colors specified as hexadecimal strings into R colors. This includes the usual format for R colors but also the shorter three letters format. In addition the #
sign can be omitted.
hex(x)
x |
hexadecimal string specifying a color; named R or CSS color are also tolerated. |
Hexadecimal strings (hex for short) are how colors are usually represented in R. This function just brings a little more versatility in how those can be specified. Note, however, that R can use the 8 letter model to represent color with a transparency (alpha) component and that this function does not support it (and just removes the transparency).
A vector of colors specified as hex codes
parse_color
for the general function to parse colors in various specifications (which this function calls internally) and convert_color
to convert parsed colors to another model.
Other color specifications:
cmyk()
,
css()
,
hcl()
,
hsi()
,
hsl()
,
hsv()
,
lab()
,
parse_color()
,
rgb()
,
ryb()
,
temperature()
,
wavelength()
Other color specifications:
cmyk()
,
css()
,
hcl()
,
hsi()
,
hsl()
,
hsv()
,
lab()
,
parse_color()
,
rgb()
,
ryb()
,
temperature()
,
wavelength()
hex("#ff3399") hex("ff3399") hex("ff3399") hex("F39") x <- c("#ff3399", # hex specification valid in R "F39", # hex specification not valid in R "whitesmoke", # named color valid in R and CSS "darkorchid2", # named R color (not existing in CSS) "rebeccapurple" # named CSS color (not existing in R) ) hex(x) (half_transparent <- alpha("#ff3399", 0.5)) hex(half_transparent) # NB: the transparency portion (last two positions: '80') is removed
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.