Closed snaggen closed 2 months ago
Grey0 is very close to comment colors, which is difficult to distinguish from.
I’m considering adding a background color along with grey0 foreground colors, and make this behavior as a configuration option. @antoineco what do you think?
With rust-tools I actually had the same color for the virtual text based inlay hints as the comments. That was not a very big issue, since it is quite clear which is which just on the placement. This is getting even more clear with the native inlay hint. And, with grey0 for inlay hints, the comment is noticeably brighter so I do not see a huge issue confusing them.
However, I'm not good with aesthetics, so if you are able to do something that is more clear and better looking, I'm not going to stop you. But keep in mind, that there are a lot of inlay hints (at least in some languages like rust) and they are going to be mixed in with the code. So you probably want something subtle that doesn't steal that much attention.
This is a sample so you can see a full rust function with a comment on top, to see how it looks now for me with grey0.
@sainnhe I don't use inlay hints and I'm unfortunately not available this week, so I don't have an opinion to share right now. I can look into it next week though.
@antoineco No problem! I'm going to deal with this issue, have a nice time :)
Sorry for late reply.
What if using inline comments like this? In many situations, using grey in inlay hints is not very distinguishable. A basic responsibility for a color scheme is making different elements easy to be distinguish from.
IMO, compared to using grey0 as foreground color, it might be better to have a background color like this:
Or colored bg:
Or darker bg:
I'm going to adding a configuration option to allow users adjust the style of inlay hints. If you are not satisfied with this, you can fork this repository and modify the code yourself.
What I mean is that inlay hints are just a hint, not something that should grab to much attention. And, I do not see them that semantically different than a comment, so I think it makes sense for them to be similar to comments. But, as you point out, you are free to choose what is best, and I'm sure you are better than me when it comes to styling and aesthetics. I'm just giving my input as a developer that rely on inlay hints a lot.
I recently started using LSP inlay hints in Neovim, and I have to agree with the sentiment that using the same color as comments is visually confusing.
As much as I understand that the inlay text may feel too dark to some people, we need to default to something unobtrusive and avoid mixing semantics.
Luckily, it is fairly simple to override the colorscheme's defaults using an autocmd
. This approach has the advantage of applying only to the colorscheme that matches the given pattern
, so it is possible to switch conveniently between colorschemes without having to modify the Neovim configuration that way:
For this particular request, I suggest declaring the following autocmd
inside init.lua
:
vim.api.nvim_create_autocmd('ColorScheme', {
group = vim.api.nvim_create_augroup('custom_highlights_gruvboxmaterial', {}),
pattern = 'gruvbox-material',
callback = function()
local config = vim.fn['gruvbox_material#get_configuration']()
local palette = vim.fn['gruvbox_material#get_palette'](config.background, config.foreground, config.colors_override)
local set_hl = vim.fn['gruvbox_material#highlight']
set_hl('LspInlayHint', palette.grey1, palette.none)
end
})
I have done the following steps before reporting this issue:
Operating system/version
Fedora Linux 39
Terminal emulator/version
wezterm 20231203-124028-e3cd2e93
$TERM environment variable
xterm-256color
Tmux version
No response
Feature matrix
Minimal vimrc that can reproduce this bug.
The important part is
To get a more readable I use this
Steps to reproduce this bug using minimal vimrc
Having an lsp with inlay hints configured, you can just open a file that uses that LSP
Expected behavior
The version where I fixed it using grey0 it looks like this (which I prefer)![image](https://github.com/sainnhe/gruvbox-material/assets/6420639/cfa2cc7f-4818-465e-91c4-88b6541c8332)
Actual behavior
The default color for the Inlay hints look like this![image](https://github.com/sainnhe/gruvbox-material/assets/6420639/3e5546e5-bda7-49e3-94d1-d2a5d3ef3467)