Skip to content
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

WinBar highlight is off in Neovim 0.10 #203

Closed
2 tasks done
sarmong opened this issue May 16, 2024 · 12 comments
Closed
2 tasks done

WinBar highlight is off in Neovim 0.10 #203

sarmong opened this issue May 16, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@sarmong
Copy link

sarmong commented May 16, 2024

I have done the following steps before reporting this issue:

  • I have searched the existing issues
  • I have read the FAQ in the help doc

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

@sarmong sarmong added the bug Something isn't working label May 16, 2024
@antoineco antoineco self-assigned this May 16, 2024
@antoineco
Copy link
Collaborator

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

@antoineco
Copy link
Collaborator

I found the culprit: neovim/neovim#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:

  • The statusline is bright and becomes dimmed in non-current windows
  • The winbar is dark and doesn't change color in non-current windows (but the text is bold in the active window)

image

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

@antoineco
Copy link
Collaborator

@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

@antoineco antoineco changed the title Add WinBar highlight WinBar highlight is off in Neovim 0.10 May 17, 2024
@sarmong
Copy link
Author

sarmong commented May 18, 2024

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
Copy link
Collaborator

antoineco commented May 18, 2024

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
Copy link
Collaborator

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
statusline plugins
image

antoineco added a commit to sainnhe/everforest that referenced this issue May 19, 2024
antoineco added a commit to sainnhe/sonokai that referenced this issue May 19, 2024
antoineco added a commit to sainnhe/edge that referenced this issue May 19, 2024
@sarmong
Copy link
Author

sarmong commented May 24, 2024

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
Copy link
Collaborator

@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
Copy link
Author

sarmong commented May 24, 2024

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

@antoineco
Copy link
Collaborator

Fully agree. It's indeed bold by default, and in #203 (comment) I also suggested to make it bold, the attribute simply got lost while linking.

antoineco added a commit that referenced this issue May 24, 2024
Adjust the style of the winbar based the user's configuration (style and
transparency), similarly to the statusline.

The WinBar highlight group is deliberately left unlinked from StatusLine
to avoid changes by plugins to have undesired side effects on the
winbar.

Ref. #203
@antoineco
Copy link
Collaborator

antoineco commented May 24, 2024

@sarmong the change is now on master.

@sarmong
Copy link
Author

sarmong commented May 24, 2024

Thank you

antoineco added a commit to sainnhe/everforest that referenced this issue Jun 22, 2024
Adjust the style of the winbar based the user's configuration
(transparency), similarly to the statusline.

The WinBar highlight group is deliberately left unlinked from StatusLine
to avoid changes by plugins to have undesired side effects on the
winbar.

Ref. sainnhe/gruvbox-material#203
antoineco added a commit to sainnhe/sonokai that referenced this issue Jun 22, 2024
Adjust the style of the winbar based the user's configuration
(transparency), similarly to the statusline.

The WinBar highlight group is deliberately left unlinked from StatusLine
to avoid changes by plugins to have undesired side effects on the
winbar.

Ref. sainnhe/gruvbox-material#203
antoineco added a commit to sainnhe/edge that referenced this issue Jun 22, 2024
Adjust the style of the winbar based the user's configuration
(transparency), similarly to the statusline.

The WinBar highlight group is deliberately left unlinked from StatusLine
to avoid changes by plugins to have undesired side effects on the
winbar.

Ref. sainnhe/gruvbox-material#203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants