-
-
Notifications
You must be signed in to change notification settings - Fork 123
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 kitty default background color at runtime for workaround #1292
Comments
You want OSC 6 not OSC 4 see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html |
And the escape codes i was talking about were for the color stack, i.e. saving the current color table and dynamic colors on a stack so that you can change them. OSC 6 which is used to set and report the dynamic colors (bg, fg, selection ,etc) has been supported in kitty since forever. |
Perhaps I don't have the full context here, and is misreading what is being said here. If so, I apologize. But it sounds like it's being suggested here that OSC 6 can be used to set and retrieve default fg/bg/selection colors. That's not true, at least not in XTerm. OSC 6 is related to OSC 5. OSC 5 sets XTerm's Special colors:
The user can enable modes where XTerm renders e.g. underline text, not with underlines, but with a custom color. OSC 5 sets the color, and OSC 6 enables/disables the mode. I.e. if you do echo -e '\e]5;1;rgb:ff/00/00\e\\`
echo -e '\e]6;1;1\e\\` Then echo -e '\e[4mhello\e[m' will be rendered in red, but not underlined. To set/get fg/bg/selection colors, use OSC 10-19:
Granted, the documentation is perhaps not structured in the best possible way, and is easy to misread. |
yes, sorry, OSC 10-19 and 110-119, not OSC 6 |
we're now sending the query along with our other ones at initialization, and getting a response from at least Kitty and Alacritty:
and
|
w00t! |
|
xterm looks good |
foot now works after some quick |
As discussed in #1117, kitty treats a setbf that equals the default background color as background, in order to e.g. provide transparent backgrounds for apps that don't explicitly use the default background color.
We work around this by changing the background color by 1 when it is 0x000000. If the default background color isn't 0x000000, though, this isn't going to work. We need to detect the default background color at runtime to handle this fully generally.
@kovidgoyal, you mentioned in that bug that you would implement the xterm sequences corresponding to this. I am unaware of any such XTerm sequence (AFAIK, XTerm implements
OSC 4 ; N; ? ST
s.t. 0 ≤ N ≤ 255). ITerm2 implements:OSC 4 ; -2; ? ST
(get default background)OSC 4 ; -1 ; ? ST
(get default foreground)did Kitty ever get support for these, or something else? Testing with the current head (0.19.3+) seems to indicate support for palette lookup (0..255), but not -1/-2.
The text was updated successfully, but these errors were encountered: