You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an HTTP command line client using rich, which is looking great, but I'm having a few problems getting the syntax highlighting just right.
The problem is that I really want to use the whatever the existing console background colour is, but also want a theme that works well on both light & dark consoles, so need to also be able to use the default foreground text colour for at least part of the theme.
Their default theme is "auto" which uses pygment's TerminalFormatter, and which results in a theme that has a different foreground text depending on the terminal style.
I don't think I'm currently able to replicate something similar in rich.
Similarly, for cases where a user does explicitly select a theme, I'd ideally still like to use the terminal background, rather than painting over it. I can do this part, but only by digging into private API...
It looks like Pygments terminal formatter essentially has its own theme that maps to ansi colors. I think I can replicate that. There are actually 2 terminal "themes" in the terminal formatter, for light and dark backgrounds.
What I might do is add a special case "ansi_light" and "ansi_dark" themes. Although I doubt the distinction is necessary unless the terminal is using the default primary colors (probably just cmd.exe).
I will also add an option to override the background color, which you can set to "default"
You can set the theme to "ansi_dark" or "ansi_light" which will use system defined colors. You can also set background_color="default" to force the background to be transparent.
I'm working on an HTTP command line client using rich, which is looking great, but I'm having a few problems getting the syntax highlighting just right.
The problem is that I really want to use the whatever the existing console background colour is, but also want a theme that works well on both light & dark consoles, so need to also be able to use the default foreground text colour for at least part of the theme.
An example of a tool that gets this right is
httpie
- https://github.com/httpie/httpieTheir default theme is "auto" which uses pygment's
TerminalFormatter
, and which results in a theme that has a different foreground text depending on the terminal style.I don't think I'm currently able to replicate something similar in rich.
Similarly, for cases where a user does explicitly select a theme, I'd ideally still like to use the terminal background, rather than painting over it. I can do this part, but only by digging into private API...
Ideally I'd love to find a good way to get two things out of this...
The text was updated successfully, but these errors were encountered: