Replies: 2 comments 3 replies
-
There is no standard way to detect the terminal background. There are a few ways that work on some terminals, but on most terminals it is impossible AFAIK. If you want the highlighting to blend with the user's color theme your only option is to use an ansi_* theme. Alternatively you could expose the theme via a env var or setting. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Perhaps it's worth implementing something like this for rich? https://github.com/dalance/termbg I think this issue is going to be quite common. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Rich to highlight output from the Hypothesis ghostwriter (code), but unfortunately the
monokai
theme is unreadable on light-background terminals. Is there any way to tell whether the terminal background color is light or dark, so that I can usemonokai_light
ormonokai
themes respectively?Setting a background color leaves many trailing spaces when the output is piped into a file, as well as being less pretty (see #990). The ansi_light or ansi_dark themes are readable (#284) but relatively ugly.
Beta Was this translation helpful? Give feedback.
All reactions