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
Describe the feature or problem you’d like to solve
When viewing rendered Markdown via a command like gh repo view, gh attempts to automatically determine whether the current terminal theme is light-on-dark or dark-on-light so it can decide what Glamour theme to default to. This works in some cases, but there's one case where it doesn't work (and it affects me, so it's important): when running gh in GNU Screen. (By "doesn't work," I mean that gh falls back to the "dark" Glamour style even when my terminal is black-on-white and thus should get the "light" Glamour style.)
Proposed solution
I'm assuming that gh currently tries to detect the terminal theme by outputting the xterm-specific sequence "\x1b]11;?\x1b\\" and parsing whatever the terminal sends back. This does not work for Screen. Per the source code for the termbg Rust library, the correct sequence to use when the TERM envvar starts with "screen" is "\x1bP\x1b]11;?\x07\x1b\\\x03", and I can confirm that this works as of Screen 4.9.1. (termbg also lists "\x1bPtmux;\x1b\x1b]11;?\x07\x1b\\\x03" for when the TMUX envvar is set; this also works on my Screen.)
It's likely that gh may be using a third-party library for autodetection, but I don't know what that would be. If so, this feature request will have to be forwarded to that library.
The text was updated successfully, but these errors were encountered:
@jwodder Sorry that you have run into this issue. I was able to reproduce it locally. As you correctly surmised we are using a third party package, termenv, to do our determining of the terminal theme. I took a quick glance at the code there and spotted this which seems to suggest that when using screen or tmux that it bails on trying to determine the terminal theme, falls back to using the environment variable COLORFGBG, and if that is not set then uses black. I was able to use that information to trigger the correct markdown theme using:
COLORFGBG="1;15" gh repo view cli/cli
Overall, I think this feature request should be forwarded to termenv to see if they would like to support screen using the specific sequence you mentioned. What do you think?
Describe the feature or problem you’d like to solve
When viewing rendered Markdown via a command like
gh repo view
,gh
attempts to automatically determine whether the current terminal theme is light-on-dark or dark-on-light so it can decide what Glamour theme to default to. This works in some cases, but there's one case where it doesn't work (and it affects me, so it's important): when runninggh
in GNU Screen. (By "doesn't work," I mean thatgh
falls back to the "dark" Glamour style even when my terminal is black-on-white and thus should get the "light" Glamour style.)Proposed solution
I'm assuming that
gh
currently tries to detect the terminal theme by outputting the xterm-specific sequence"\x1b]11;?\x1b\\"
and parsing whatever the terminal sends back. This does not work for Screen. Per the source code for thetermbg
Rust library, the correct sequence to use when theTERM
envvar starts with "screen" is"\x1bP\x1b]11;?\x07\x1b\\\x03"
, and I can confirm that this works as of Screen 4.9.1. (termbg
also lists"\x1bPtmux;\x1b\x1b]11;?\x07\x1b\\\x03"
for when theTMUX
envvar is set; this also works on my Screen.)It's likely that
gh
may be using a third-party library for autodetection, but I don't know what that would be. If so, this feature request will have to be forwarded to that library.The text was updated successfully, but these errors were encountered: