Skip to content

[REQUEST] Respect PY_COLORS environment variable #343

@ssbarnea

Description

@ssbarnea

PY_COLORS is a very popular method for forcing ANSI mode on or off in a command line application.

Basically undefined means keeping application default behavior, likely auto-detection. Having it PY_COLORS=0 means application will not use any ANSI codes and PY_COLORS=1 will force ANSI mode regardless if terminal reports it or not.

For me personally is not a big deal as I already have code in applications I work with, but it would prove useful to have this directly into rich, so any user of rich would get this for free.

An implementation example can be seen at https://github.com/ansible-community/molecule/blob/20e1fa8a23308a9103e2dbdb4d3c4ae1ffe59c9d/molecule/logger.py#L42-L48

That is very useful feature to have when running on CI as you do not want to end-up defining 50-100 environment variables only to control ANSI behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedTask was accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions