col2hex: Convert color to hex

Description Usage Arguments Details Value See Also Examples

View source: R/col2hex.R

Description

Convert color to hex

Usage

1
col2hex(color, alpha = 1)

Arguments

color

Character string. An R color or color as hex.

alpha

Transparency. A value from 0 to 1 (default).

Details

This function is primarily to be used on R colors, and will convert them to hexmode sufficient for typical use in visualization, web presentation, etc. If you already have a hex value, it can be useful for tacking on the alpha level.

Value

A character string of a hexadecimal color

See Also

as.hexmode colors col2rgb rgb

Examples

1
2
3
library(visibly)
col2hex('red')
col2hex('#ff5500', alpha = .1)

m-clark/visibly documentation built on Oct. 28, 2020, 5:33 p.m.