Convert color to Hex string
Arguments
- col
character or integer indicating color
- alpha
NULLor numeric, transparency. SeegrDevices::rgb- prefix
character, default is
"#"- ...
passing to
adjustcolor
Details
col2hexStr converts colors such as 1, 2, 3, "red", "blue", ... into
hex strings that can be easily recognized by `HTML`, `CSS` and `JavaScript`.
Internally this function uses adjustcolor with two differences:
the returned hex string does not contain alpha value if
alphaisNULL;the leading prefix "#" can be customized