Skip to contents

Is it a hex color?

Usage

is_hex_color(x)

Arguments

x

A character vector.

Value

Logical vector; TRUE for #RGB or #RRGGBB.

See also

Other color detectors: is_cmyk_color(), is_color_name(), is_hsl_color(), is_rgb_color()

Examples

is_hex_color(c("#4d9cf8", "#fff", "4d9cf8", NA))
#> [1]  TRUE  TRUE FALSE    NA