has_color {crayon} | R Documentation |
Does the current R session support ANSI colors?
has_color()
The following algorithm is used to detect ANSI support:
If the crayon.enabled
option is set to TRUE
with options()
, then TRUE
is returned. If it is
set to something else than TRUE
(typically FALSE
),
then FALSE
is returned.
Otherwise, if the standard output is not a terminal, then
FALSE
is returned.
Otherwise, if the platform is Windows, FALSE
is returned.
Otherwise, if the COLORTERM
environment variable is
set, TRUE
is returned.
Otherwise, if the TERM
environment variable starts
with screen
, xterm
or vt100
, or matches
color
, ansi
, cygwin
or linux
(with case insentive matching), then TRUE
is returned.
Otherwise FALSE
is returned.
TRUE
if the current R session supports color.
has_color()