-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
background_opacity + setbf(0, 0, 0) draws default background color, not black #3185
Comments
This is intended behavior. Background colors that exactly match the default background color, whatever it may be are rendered as transparent. IIRC this was done so that applications like alsamixer that dont set the default background color still are transparent, see 2045055 |
Got it. I'm unaware of any other terminals with this behavior, but that doesn't make it "wrong". Do you expose any (non-standard) terminfo capability expressing this behavior? If not, would you consider doing so? So in the case above, where I've got a (partially-)transparent kitty, and a default background color N, and I authentically want a background of N (not transparent), is there any way to get it? I.e. in the example above, how do I get a black background? Apologies if I'm missing something obvious. |
I guess if I can detect the configured default background color, I can match that against my desired color, and if they're equal (and the hypothetical terminfo capability has been detected), I could emit |
alternatively...may I ask how committed to this feature you are? I can understand the appeal and motivation for the original change, but it's in my opinion an unexpected departure from the norm, and it seems to be causing problems for other applications (see the broken Vim screenshot in the original bug). I think it was a neat idea, but in practice it seems to punish certain classes of applications. Just a suggestion; I don't mean to offend. |
I dont know about other terminals though I have a vague memory that alacritty does this too, but maybe I am mis-remembering. No, there isn't any way of forcing background color to non-transparent. Your best bet is to use a color that's just off the background color, like (0, 0, 1). So you would set the default bg to X and use X+1 as the forced opaque bg color. I actually dont like this behavior at all, however, the sad state of affairs is that a lot of applications alsamixer/vim for instance, dont set default bg color and instead color all cells with their background color, without this behavior, they would become unuseable with transparency. You can query colors, there are escape codes for it, but rather than use those, you could just set your own and save/restore the previous ones using this: https://sw.kovidgoyal.net/kitty/protocol-extensions.html#saving-and-restoring-the-default-foreground-background-selection-cursor-colors As for terminfo capability, it would need to be custom, so only kitty's terminfo would have it, so why bother, just detect kitty instead. You can use the existing escape code to query terminal name, or get it from terminfo or use https://sw.kovidgoyal.net/kitty/kittens/query_terminal.html |
Thanks for the detailed response, @kovidgoyal . Alright, let's close this down as works-as-intended. For what it's worth, no, current alacritty does not have this behavior (see image below). I only see it in Kitty from my testing matrix of { xterm, mlterm, alacritty, kitty, konsole, xfce4-terminal, gnome-terminal, sr }. I don't love the idea of changing the default color, since the user presumably selected one (in the case of non-default) purposefully. I'll look into whether that color can be retrieved, and do that if so. Otherwise, I'll probably go with the save/restore. |
You can definitely query them using OSC escape codes, see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands |
indeed, thanks for the pointer! |
Describe the bug
kitty 0.19.3 draws the default background color instead of black when given
setbf(0, 0, 0)
.To Reproduce
Steps to reproduce the behavior:
\33[48;2;0;0;0m
\33[48;2;0;0;1m
.Expected behavior
I expect
setbf 0;0;0
to set the background color to 0x000000 (black). Perhaps I am wrong? Instead, kitty is setting the background color to the "default color".Screenshots
Here, my kitty background is transparent.
The string I'm writing the second time is
\33[?1h\33(B\33[0m\33[38;2;100;100;100m\33[48;2;255;255;255ma\33[48;2;0;0;0mb \33[48;2;0;0;1mc \33[48;2;255;255;255md\n
.Environment details
OS: Linux 5.10.1 on Debian Unstable using Notcurses 2.1.1
Additional context
This behavior does not occur with
--config NONE
. It appears to requirebackground_opacity N
where N < 1.0.The text was updated successfully, but these errors were encountered: