Skip to content

Disable colorization by default if output is not a text terminal #53

@specious

Description

@specious

By convention, I am used to colorized applications suppressing colorization when sending the output to a pipe, unless I explicitly force colorization.

For example, in colors.js:

if (process.stdout && !process.stdout.isTTY) {
  return false;
}

Writing an app using colorize, I was surprised that colors were not suppressed when doing app > file.txt or app | cat. The color codes can cause problems in later processing stages.

I then turned colorization off for non-TTY output with:

String.disable_colorization(true) unless STDOUT.isatty

I'd like to propose that be the default behavior, with a way to force colors by choice in all cases.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions