romgrk / barbar.nvim

The neovim tabline plugin.
2.23k stars 83 forks source link

How can I change the current tab background colour? #357

Closed eggbean closed 1 year ago

eggbean commented 1 year ago

I use the nightfox.nvim theme (nordfox variant) and the current tab background colour comes up in a grey that is too light. It stands out too much, so I want to change it to a slightly darker grey.

How can I do this? I have been making occasional attempts at this for several months and nothing I do helps. I have only been able to change the background colour of the entire top bar, but not any of the tabs. I only want to change the background colour of the current tab.

Is it possible that the theme I use is overriding any changes?

Thanks.

romgrk commented 1 year ago

Check highlight.lua to see the default highlight groups we use and their defaults. You can override any of them.

Iron-E commented 1 year ago

Dupe of #354. Just disregard the actual highlight group mentioned there (i.e. BufferTabpageFill). The README or :h barbar.nvim should give all the info needed, as well as :h :hi. If you have other questions feel free to leave them in that other issue

If it comes to light that this is a bug we can reopen, but I'm thinking of it as a dupe for now.

eggbean commented 1 year ago

I still don't know how to do this. I find it very hard to understand lua for some reason. What do I need to do to change the background colour of the current tab and where does it fit in the barbar config that I have here?

Iron-E commented 1 year ago

@eggbean see https://github.com/romgrk/barbar.nvim/issues/357#issuecomment-1403033758

eggbean commented 1 year ago

@eggbean see #357 (comment)

Are you saying I should post in the other thread? As that issue is about another element, while I want to change the background colour of the current tab.

I can change parts of it with this:

:hi BufferCurrent guibg=Green
:hi BufferCurrentSign guibg=Green

But I end up with this:

image

Iron-E commented 1 year ago

Apologies for the late reply.

Seems like you're experiencing #281. That was resolved by https://github.com/romgrk/barbar.nvim/pull/282#issuecomment-1234499777. Try that augroup setup + ordering and see if that doesn't resolve the issue

eggbean commented 1 year ago

Ah, great. Finally fixed it. Cheers.

vim.api.nvim_create_autocmd('Colorscheme', {
  group = vim.api.nvim_create_augroup('config_custom_highlights', {}),
  callback = function()
    -- Current tab colour adjustments for barbar.nvim
    vim.api.nvim_set_hl(0, 'BufferCurrent', {bg = '#44475A'})
    vim.api.nvim_set_hl(0, 'BufferCurrentSign', {bg = '#44475A'})
    vim.api.nvim_set_hl(0, 'BufferCurrentMod', {bg = '#44475A'})
  end,
})