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

Detect true-color terminal support for pygmentize #2160

Merged
merged 2 commits into from Jun 13, 2022
Merged

Detect true-color terminal support for pygmentize #2160

merged 2 commits into from Jun 13, 2022

Conversation

micahcochran
Copy link
Contributor

For the pygmentize command line, this pull request adds detection of true-color support on the terminal and makes that the default formatter. It looks up the COLORTERM environment variable having a value of truecolor or 24bit. If that is the case, it sets the default formatter to use the TerminalTrueColorFormatter.

The COLORTERM environment variable is a convention that has been adopted by some terminals for specifying true-color is supported.

Copy link
Contributor

@jeanas jeanas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but you need to update the documentation in doc/docs/cmdline.rst.

@micahcochran
Copy link
Contributor Author

I added a second commit, which documents how the terminal determines the maximum number of colors supported.

@jeanas
Copy link
Contributor

jeanas commented Jun 13, 2022

Thanks!

@jeanas jeanas merged commit 126cf8c into pygments:master Jun 13, 2022
@Anteru Anteru added this to the 2.13.0 milestone Jun 19, 2022
@Anteru Anteru added the A-formatting area: changes to formatters label Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-formatting area: changes to formatters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants