assert_color()
ensures that the provided color values are valid color
names recognized by grDevices::colors()
or valid hexadecimal color codes
(#RGB
or #RRGGBB
).
Value
color
(as invisible) if it passes the test; an
error message otherwise.
Examples
assert_color("#FFF")
assert_color("#FF5733")
assert_color("#FF0000FF")
assert_color("blue")
assert_color("transparent")
assert_color(c("#FF5733", "blue", "transparent"))