Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off color via PY_COLORS=0 #5057

Closed
starblue opened this issue Apr 19, 2022 · 5 comments · Fixed by #5080
Closed

Turn off color via PY_COLORS=0 #5057

starblue opened this issue Apr 19, 2022 · 5 comments · Fixed by #5080
Labels
Type: Enhancement 💡 This is a feature or enhancement request.

Comments

@starblue
Copy link

Please support a more standard way to turn off colors. It is tedious to turn off color for every tool separately, especially since with PY_COLORS there exists a general way for the Python ecosystem.

Even better would be to respect NO_COLOR=1, which IMHO is the closest thing to a general standard. General support for this would avoid playing whack-a-mole with every new tool that comes along.

Also, there are many valid reasons not to want colors on the command line, so calling the environment variable PIPENV_COLORBLIND is in rather bad taste.

@oz123
Copy link
Contributor

oz123 commented Apr 19, 2022

I think this is a very good issue to work on. I also added this feature in the past to pip :-).
pypa/pip#4739

This will take quite some time to implement this here. Been talking with @matteius about removing all the usage of crayons and only using click.echo. If click.echo has a global way to disable color that would be easy!

@oz123
Copy link
Contributor

oz123 commented Apr 20, 2022

In PIPENV the place for this would be:

PIPENV_COLORBLIND = bool(os.environ.get("PIPENV_COLORBLIND"))

@matteius
Copy link
Member

tartley/colorama#268

@matteius
Copy link
Member

matteius commented Apr 20, 2022

I agree with a comment someone left somewhere else recently that the name PIPENV_COLORBLIND is in bad taste. It looks like colorama will maybe one day soon support a NO_COLOR environment variable ... that is what click uses, but only for Windows I think. Edit: Oh it was this thread, from the author @starblue

@matteius matteius added the Type: Enhancement 💡 This is a feature or enhancement request. label Apr 21, 2022
@oz123
Copy link
Contributor

oz123 commented Apr 23, 2022

There is another way to disable colors in pipenv which we inherit from vistir.termcolors:

DISABLE_COLORS = os.getenv("CI", False) or os.getenv(
    "ANSI_COLORS_DISABLED", os.getenv("VISTIR_DISABLE_COLORS", False)
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement 💡 This is a feature or enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants