-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Use background color for character below cursor #126
Comments
Implementing it is probably not difficult, but why background color? Shouldn't it be a dedicated color contrasting with the cursor color? After all the background color changes depnding on the application. |
I suppose that would indeed be more appropriate. |
Hmm I'm not convinced this is a good idea. With a blinking cursor it would look pretty bad to have the foreground color changing both when cursor moves and on blink. But maybe I am imagining it. Do you know of any other terminal that have this feature, so Ican try it out and see how it looks, before spending the time to implement it? |
The text is rendered in the background color on top of the opaque block cursor. We use the background color since applications can change both cursor and background colors, so it is up to the application to ensure the colors have good contrast. Fix #126
Implemented in the fast branch. |
Works great, thanks! |
Is there any way to use a constant color for the text under the cursor? The current approach causes a visibility problem if the cursor is light and it is currently over some text with a light background. I'm imagining two separate settings: If cursor_foreground is unspecified, then kitty can fallback to the current behaviour. What do you think? Thanks for an incredible terminal! |
There are three possible approaches:
Different terminals typically support one of these three approaches. And different kitty users have requested all three at different times. I am fine with (1) and (2). The problem with (3) is that it breaks the terminal escape codes used to change cursor colors. That said I also dont much see the point of (1). You should set your cursor color to have good contrast with the background color. If you do that and you still have poor contrast with text , then that means the text already has poor contrast with the background, and is hard to see regardless of whether the cursor is over it or not. |
Yeah, the easiest thing to do is change either the search highlight color to be a bit darker, or your cursor color to be a bit darker. Although, given that the cursor blinks, it isn't that hard to see the text under it :) |
There you go: 55fc5c4 |
Thank you, I'll give it a try! EDIT: It works great! |
…r in a fixed color. See kovidgoyal#126
@kovidgoyal is cursor color invertion supported? (as showed in #126 (comment)) I've tried the |
As I said above, I am not a fan of inversion because it breaks the terminal escape codes used to set cursor colors. It means that it is no longer possible for terminal applications to control cursor colors, as needed. |
Ok, I get your point, it's true that it has downsides. However, I think that ultimately, if the user really wants to have inversion, it should have priority over terminal applications. |
Simply have neovim change the cursor color as part of changing the color scheme. That's the whole point of having application controllable cursor colors in the first place. If you dont know how to get neovim to do that, make a shell script wrapper for it that changes the cursor color and then launches it. It would be a five line script. The problem with having inverted colors is that it means the entire ecosystem can no longer rely on being able to change cursor colors, so that feature becomes unusable for everybody. |
@kovidgoyal @romgrk
Exactly. :) |
I'm not using kitty at the moment so I don't plan to submit a PR. |
@romgrk What are you using now? |
tilix |
The lack of cursor color inversion is what's preventing me from switching from Alacritty, which has this on by default. |
I wish to move away from Alacrity but this is a let down a little |
Same as gshpychka,I feel this is the only feature alacritty has over kitty. |
I don't disagree that in a vacuum this is something that makes more sense for an application (vim, zsh, etc.) to handle than a terminal. But the reality is many terminals support this and it's an (admittedly weird) turn-off when a terminal doesn't. At the end of the day it's subjective and many of us like our cursors behaving this way while many may not. I'm not the author but I don't see what harm it does to add in a strongly-requested feature and let people opt-in to it if they wish. My personal reason for liking this and using it in every terminal I use is very well captured in the image that @Asheq shared above. In ~5 years of doing this in various terminals (termite being my most recent) I have not once seen a color combination that was hard to see such as in the aforementioned gif. Which is kind of the point---it's at the very least extremely unlikely if not outright impossible. |
Alacricity handles cursor so nicely, but dont play nice with x wm motif and size hints, Kitty handles size hints nicely and support X spec, but this bad vi cursor color support,,,, still bad cursor better than bad size hints, Ive been telling myself 😬 but it hurts!! wezterm?! 🎉 |
Uh probably https://github.com/belluzj/fantasque-sans
…Sent from my iPhone
On 18 Aug 2021, at 09:04, yebt ***@***.***> wrote:
iTerm2 for macOS does this. I don't know of any terminal applications on Linux that does this, but I'm sure there has to be some. I've attached a short gif demonstrating the behaviour with the effect I'd like.
[cursor]<https://user-images.githubusercontent.com/6175959/30511158-5cd1765e-9ad3-11e7-99bc-ed4e5019244d.gif>
What is this font?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#126 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABPDZV7OW7WWDHZNVX4T5X3T5NLPVANCNFSM4D3FIPOQ>.
|
I'm missing the Alacritty way of highlighting cursor too.
|
Thanks a lot for implementing this. Looks great! Seoul256 theme: 2021-10-27.23.45.15.mov2021-10-28.00.16.30.movCake16 theme: 2021-10-27.23.43.53.movNord theme: 2021-10-27.23.40.32.mov |
And here is how it looks in iTerm2: 2021-10-28.00.27.27.mov2021-10-28.00.26.34.mov2021-10-28.00.25.42.mov2021-10-28.00.25.05.mov |
The good lord alone knows what iTerm is doing. That's not reverse video, that's some pick whatever cursor color I think looks good algorithm. If you like it so much feel free to look in its source code and figure out the algorithm and submit a PR for it, you just need to modify the pick_cursor_color() function in kitty. |
Thanks a lot for implementing this, I will look into switching from alacritty now. |
As I understand, what is expected to happen when you have anything selected (as because is below the cursor or just a big selection) is that background should be the text color and text color should be cursor background color. And just that character, the others must have the normal color. Should be easier to implement than the last change you did. Just invert colors for that character, no more. |
As you can see in the first video, both braces change color. This is not expected (or doesn't work like this in Alacritty or other terms) |
I dont know what you are talking about. The cursor and the cursor alone changes color because fo kitty. anything else changing color is because vim changed its color. |
No, it is not. I don't even have to look at the code at all. iTerm2 uses the text foreground color as the cursor background color. When the color is lighter than 50%, black is used as the cursor text color. When the color is darker than 50%, white is used instead. Black and white refer to two of the 8 ANSI colors in the iTerm2 configuration. This is clearly not a reverse video effect. And this iTerm2 feature is completely dead when the cursor is on RGB true color text. |
I am talking about Alacritty and gnome-terminal, I hadn't used iTerm2. |
I tried |
I've just noticed that this was implemented :O Thanks a lot for this, @kovidgoyal ! |
you are welcome! |
After playing with this for a while trying to get it to work, i realised the themes were setting the cursor colors. Can the |
On Wed, Feb 14, 2024 at 09:19:56PM -0800, Joel Eapen wrote:
After playing with this for a while trying to get it to work, i realised the themes were setting the cursor colors. Can the `kitty.conf` to override the colors from `current-theme.conf` so switching between themes with `kitten themes` doesn't interfere with my permanent options? Thanks.
Use --config-file-name for the themes kitten and include that file in
kitty.conf, then the themes kitten wont touch kitty.conf.
|
|
On Wed, Feb 14, 2024 at 10:56:31PM -0800, Joel Eapen wrote:
> On Wed, Feb 14, 2024 at 09:19:56PM -0800, Joel Eapen wrote: After playing with this for a while trying to get it to work, i realised the themes were setting the cursor colors. Can the `kitty.conf` to override the colors from `current-theme.conf` so switching between themes with `kitten themes` doesn't interfere with my permanent options? Thanks.
> Use --config-file-name for the themes kitten and include that file in kitty.conf, then the themes kitten wont touch kitty.conf.
`kitten themes --config-file-name` modifies `themes.conf` with `incude current-theme.conf`, which contains a new cursor value from the chosen theme. `kitty.conf` is untouched, but `current-theme.conf`'s cursor value takes precedence over `cursor none` in `kitty.conf`
No, it doesnt, provided you put cursor none **AFTER** the include
|
As per the title; it would be nice to be able to have kitty draw the character currently below the block cursor in the same color as the background color.
I did not find any way in the current setting to allow for this, and it would go really well with having full cursor opacity.
Do you think this would be hard to implement, and if not, would you consider adding this?
Thanks.
The text was updated successfully, but these errors were encountered: