Skip to content

Allow disabling all color functions with a global toggle #59

@mjy9088

Description

@mjy9088
const noop = (str) => str;
const color = (colorFn) => process.stdout.isTTY ? colorFn : noop;
const red = color(colors.red);

console.log(red("This should be red only if it's an interactive shell"));

Most CLI developers end up writing boilerplate like this to conditionally disable colors in non-interactive environments (e.g., when output is redirected). It would be extremely helpful to have a built-in option or global toggle that makes all color functions no-ops automatically when needed.

This would simplify codebases and eliminate the need to wrap every color usage manually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions