Skip to content

Disabling colors for less and non-terminals #4

@trashcan

Description

@trashcan

Any suggestions on how to disable colors when the output is not to a terminal that supports color?

I can use golang.org/x/crypto/ssh/terminal's terminal.IsTerminal to detect it, but not sure how to go about modifying chalk to support this. Ideally I'd like to add color in my code, and then have chalk return nothing when it detects this so I don't have to write a colored and non-colored version.

I tried overwriting the colors (chalk.Black, chalk.Red etc) from my project but that doesn't seem to work correctly.

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