has_color: Does the current R session support ANSI colors?
Description
Does the current R session support ANSI colors?
Usage
has_color()
Arguments
Value
TRUE if the current R session supports color.
Details
The following algorithm is used to detect ANSI support:
If thecrayon.enabledoption is set toTRUEwithoptions(), thenTRUEis returned. If it is
set to something else thanTRUE(typicallyFALSE),
thenFALSEis returned.
Otherwise, if the standard output is not a terminal, thenFALSEis returned.
Otherwise, if the platform is Windows,FALSEis returned.
Otherwise, if theCOLORTERMenvironment variable is
set,TRUEis returned.
Otherwise, if theTERMenvironment variable starts
withscreen,xtermorvt100, or matchescolor,ansi,cygwinorlinux(with case insentive matching), thenTRUEis returned.