Multiplies each colour's own alpha channel (1, i.e. fully opaque,
for a colour with none already set) by alpha, via
grDevices::adjustcolor() – the same mechanism style()'s own
color_alpha/fill_alpha properties use internally at draw() time
(see ?style). Since an ordinary opaque colour's own alpha is 1,
this has the effect of setting the result's alpha to alpha directly
for any color with no alpha of its own already.
Value
A character vector of hex colour strings (including an alpha
channel), the same length as the longer of color/alpha.
See also
Other color helpers:
color_greyscale(),
color_invert(),
color_jitter(),
color_lighten(),
color_mix(),
color_rotate_hue(),
color_saturate()
Examples
color_alpha("black", alpha = 0.5)
#> [1] "#00000080"
color_alpha(palette_manual(index = 1), alpha = c(1, 0.75, 0.5, 0.25, 0.1))
#> [1] "#33658AFF" "#86BBD8BF" "#2F485880" "#F6AE2D40" "#F264191A"