Little function intended for internal use; will transform colors (expressed either as numerical or characters) into hexadecimal code.

col2hex(col)

Arguments

col

Either numeric or character; color(s) to be transformed.

Value

The color(s) used as input, but expressed as hexadecimal code(s).

Examples

plot(rnorm(n = 100), pch = 16, col = "red")

plot(rnorm(n = 100), pch = 16, col = col2hex("red"))


plot(rnorm(n = 100), pch = 16, col = 2)

plot(rnorm(n = 100), pch = 16, col = col2hex(2))