unalpha: Remove alpha transparency from colors

unalphaR Documentation

Remove alpha transparency from colors

Description

Remove alpha transparency from colors

Usage

unalpha(x, keepNA = FALSE, ...)

Arguments

x

character vector of R colors

keepNA

logical indicating whether NA values should be kept and therefore returned as NA. When keepNA=FALSE (default for backward compatibility) NA values are converted to "#FFFFFF" as done by grDevices::col2rgb().

...

additional arguments are ignored.

Details

This function simply removes the alpha transparency from R colors, returned in hex format, for example "#FF0000FF" becomes "#FF0000", or "blue" becomes "#0000FF".

It also silently converts R color names to hex format, where applicable.

Value

character vector of R colors in hex format.

See Also

Other jam color functions: alpha2col(), applyCLrange(), col2alpha(), col2hcl(), col2hsl(), col2hsv(), color2gradient(), fixYellowHue(), fixYellow(), getColorRamp(), hcl2col(), hsl2col(), hsv2col(), isColor(), kable_coloring(), makeColorDarker(), make_html_styles(), make_styles(), rgb2col(), setCLranges(), setTextContrastColor(), showColors(), warpRamp()

Examples

unalpha(c("#FFFF00DD", "red", NA, "#0000FF", "transparent"))

unalpha(c("#FFFF00DD", "red", NA, "#0000FF", "transparent"), keepNA=TRUE)


jmw86069/jamba documentation built on Oct. 9, 2024, 10:52 a.m.