Convert color to Hex string
Arguments
- col
character or integer indicating color
- alpha
NULL
or 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
alpha
isNULL
;the leading prefix "#" can be customized