Convert a color to grayscale
Usage
col2grayscale(x, what = c("color", "decimal"))
Arguments
- x
Color to convert to grayscale
- what
Character: "color" returns a hexadecimal color,
"decimal" returns a decimal between 0 and 1
Details
Uses the NTSC grayscale conversion:
0.299 * R + 0.587 * G + 0.114 * B
Examples
if (FALSE) { # \dontrun{
col2grayscale("red")
col2grayscale("red", "dec")
} # }