sainnhe / gruvbox-material

Gruvbox with Material Palette
MIT License
1.96k stars 166 forks source link

WinBar highlight is off in Neovim 0.10 #203

Closed sarmong closed 6 months ago

sarmong commented 6 months ago

I have done the following steps before reporting this issue:


Neovim 0.10 sets default highlighting for WinBar thus making active winbar black.

antoineco commented 6 months ago

Thanks for reporting! I'll have a look before next week.

antoineco commented 6 months ago

I found the culprit: https://github.com/neovim/neovim/pull/26921

I am not yet sure what visual appearance this bar should have. In Neovim's default colorscheme, the authors decided to use a style which differs significantly from the statusline:

image

I think I'm going to try something similar in gruvbox-material for a start.

antoineco commented 6 months ago

@sarmong would you mind adding this autocmd temporarily to your init.lua and giving me some feedback on the result?

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('WinBar', palette.grey2, palette.bg_dim, 'bold')
    set_hl('WinBarNC', palette.grey1, palette.bg_dim)
  end
})

image

sarmong commented 6 months ago

What do you think about using lighter color? For example, the same bg color as in lualine - I think its the bg_current_word. Or maybe just anything lighter than this one.

Because right now it's the same as the color of the tabline. image

antoineco commented 6 months ago

With so many possible bars on the screen I feel that it's going to be hard to please everyone 😅

I think I'm going to gate this behind an option like g:gruvbox_material_winbar_style and allow people to choose between 2 or 3 base styles.

One of the thing which bothered me, while trying to default to the same color as the statusline, is that the winbar of the lower window seemed to be "merging" with the statusline of the upper window.

edit: note that if I make the winbar lighter, it is likely to have the same color as your active tab.

antoineco commented 6 months ago

For the sake of having some (arguably) reasonable default in the colorscheme, I went ahead and linked WinBar[NC] to StatusLine[NC], like it was prior to Neovim v0.10. This change is meant to be simple and neutral, instead of overthinking the aesthetics.

image

In case we want to be opinionated and offer multiple default winbar styles to users, we can do that in a separate proposal. However, I would argue that statuslines and other bars (winbar, tabbar) are so often customized using plugins that we should probably stay away from trying to style them ourselves. One example is the StatusLine highlight group which, if used without plugins, looks nothing like the style applied by plugins (see example below).

StatusLine: colorscheme vs. plugin (taken from sainnhe/everforest)

_colorscheme default_ ![image](https://github.com/sainnhe/gruvbox-material/assets/3299086/a300211e-5e81-4998-826c-3df13373324c) _statusline plugins_ ![image](https://github.com/sainnhe/gruvbox-material/assets/3299086/fee3d9d4-330d-4415-ab5b-a4d0d79e31ed)

sarmong commented 6 months ago

Actually, I found a problem with linking WinBar to StatusLine when using nvim-window-picker plugin. This plugins sets highlights for the statusline and thus winbar highlight changes as well.

I know it is impossible to fit every usecase, but maybe solution to just duplicate highlighting from StatusLine to WinBar will work better than linking it?

antoineco commented 6 months ago

@sarmong sure this shouldn't be a problem. Any other feedback on the previous change? Is the aesthetic aspect satisfying? (I don't have winbar set myself)

sarmong commented 6 months ago

Maybe another thing worth considering - is making the text bold? Before the change (in 0.9) it was bold

antoineco commented 6 months ago

Fully agree. It's indeed bold by default, and in https://github.com/sainnhe/gruvbox-material/issues/203#issuecomment-2118344212 I also suggested to make it bold, the attribute simply got lost while linking.

antoineco commented 6 months ago

@sarmong the change is now on master.

sarmong commented 6 months ago

Thank you