Detect if a stream support ANSI escape charactersSource:
We check that all of the following hold:
The stream is a terminal.
The platform is Unix.
R is not running inside R.app (the macOS GUI).
R is not running inside RStudio.
R is not running inside Emacs.
The terminal is not "dumb".
streamis either the standard output or the standard error stream.
Other terminal capabilities: