Skip to content

Detect if ANSI escape codes are supported by the terminal to disable color automatically #2

@esaporski

Description

@esaporski

In a conversation with bluefish1432:

In CLI applications, it's usually reasonable for the app itself to decide when/how it can use ANSI color escape codes and when it can't. I wish there were an auto option for setting colors so that my logging function doesn't break a script running in CI if I forgot to manually specify "no color" for the logger

I know that a bunch of CI pipelines set CI=true, but I will do some research to check how I can detect if ANSI escape codes are supported by the terminal the script is currently running.

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