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

Use $COLORFGBG to help decide whether to use a dark or light style #62

Merged
merged 1 commit into from
Jun 22, 2019

Conversation

crowsonkb
Copy link
Contributor

Many terminals set $COLORFGBG to indicate the ANSI colors (or a best approximation) they are using as their foreground and background. For instance my iTerm2 sessions have it set to 0;15 (dark black on bright white) but in practice I have seen it set to 0;7, 7;0, and 15;0 by various terminal emulators. I propose looking at this variable to help decide which default style to use. is_light_bg starts off at None for unknown background color (note that this means we will still default to the dark style) and, if $COLORFGBG is present and parseable, becomes True or False.

If $PYPRETTYPRINTER_LIGHT_BACKGROUND is present it is allowed to override the detected setting based on $COLORFGBG.

@tommikaikkonen tommikaikkonen merged commit 91f7c2a into tommikaikkonen:master Jun 22, 2019
@tommikaikkonen
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants