-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Enable FORCE_COLOR and NO_COLOR for terminal colouring #10260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Could you add mentions for these envvars to doc/man/sphinx-build.rst
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After digging for few good number of minutes about why sphinx does not use colors i reached this one.
Yes, current cli arguments are not automation/scripting friendly and we are much better reusing existing standard variables for controlling the colors.
@tk0miya Can you please have another look, it seems fixed. I am really eager to get this fix in especially as the older tox trick with |
Thank you for your update. Merging now! |
pytest understands that since a while: https://pytest.org/en/7.0.x/reference/reference.html#environment-variables and other tools are adopting it: sphinx-doc/sphinx#10260
pytest understands that since a while: https://pytest.org/en/7.0.x/reference/reference.html#environment-variables and other tools are adopting it: sphinx-doc/sphinx#10260
Subject: Allow these widely-used environment variables to improve readability of output
Feature or Bugfix
Purpose
Colour can help diagnose problems, and a common place for Sphinx and the need to diagnose problems is on a CI.
However, because GitHub Actions doesn't use a tty, output of tools which autodetect the terminal output is usually monochrome.
Normally you only want to enable colour on a tty, because if you're piping data between commands (not a tty) the colour codes can mess up parsing of piped output. But that's not the case here.
That's why many tools and CI setups use the
FORCE_COLOR
environment variable, and/or command-line options to turn it back on.Other tools for reference:
Detail
NO_COLOR
takes precedencecolorama
FORCE_COLOR
nextRelates