- if ($result->options['colors'] !== null) {
- $this->colors = $result->options['colors'];
- } else if ($result->options['nocolors'] !== null) {
- $this->colors = !$result->options['nocolors'];
- } else {
- //default coloring to enabled, except
- // when piping | to another tool
- $this->colors = true;
- if (function_exists('posix_isatty')
- && !posix_isatty(STDOUT)
- ) {
- $this->colors = false;
+ $this->highlight = $result->options['highlight'];
+ if ($this->highlight == 'auto') {
+ if (php_sapi_name() == 'cli') {
+ //default coloring to enabled, except
+ // when piping | to another tool
+ $this->highlight = 'ansi';
+ if (function_exists('posix_isatty')
+ && !posix_isatty(STDOUT)
+ ) {
+ $this->highlight = 'none';
+ }
+ } else {
+ //no idea where we are, so do not highlight
+ $this->highlight = 'none';