apply_alpha | R Documentation |
Applies alpha (or opacity) to a color in hexadecimal form by
converting opacity in the [0, 1]
range to hex in the [0, 255]
range
and appending to the hex color.
apply_alpha(color_hex, opacity = 0.5)
color_hex |
A character string representing a hex color |
opacity |
Desired opacity of the output color |
A character string with added opacity level as hexadecimal characters.
blue <- "#0e6ba8"
blue_transparent <- apply_alpha(blue)
if (requireNamespace("scales", quietly = TRUE)) {
scales::show_col(c(blue, blue_transparent))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.