Check if a string has some ANSI styling

ansi_has_any(string)

Arguments

string

The string to check. It can also be a character vector.

Value

Logical vector, TRUE for the strings that have some ANSI styling.

See also

Other low level ANSI functions: ansi_hide_cursor(), ansi_regex(), ansi_strip()

Examples

## The second one has style if crayon is enabled ansi_has_any("foobar")
#> [1] FALSE
ansi_has_any(col_red("foobar"))
#> [1] TRUE