neovim icon indicating copy to clipboard operation
neovim copied to clipboard

Support bufferline highlights config

Open danymat opened this issue 3 years ago • 9 comments

Hello !

Bufferline seems to be widely used, and I tried it out (loving it so far!): https://github.com/akinsho/bufferline.nvim (cc @akinsho) It seems that rose-pine does not support it, so I wanted to add some custom highlights to it. But it seems that placing the highlights directly in the rose-pine plugin does not work.

It seems to do with the way the plugin wants us to change highlights:

    lua require'bufferline'.setup{
        highlights = {
            fill = {
                guifg = '<color-value-here>',
                guibg = '<color-value-here>',
            },
            background = {
                guifg = '<color-value-here>',
                guibg = '<color-value-here>'
            },
...

Do you have any ideas how we could make this work ?

A simple highlight to check is with BufferLineFill

danymat avatar Jan 19 '22 20:01 danymat

on mobile so i'll dive deeper when i get a chance but you could get our palette via:

local p = require('rose-pine.palette')

and use the palette in bufflerline.setup

if this does work we could add a note in the readme or figure out how to automatically configure bufferline if it's detected

mvllow avatar Jan 19 '22 20:01 mvllow

It seems to work well We now have to somehow merge the config into bufferline setup

danymat avatar Jan 19 '22 22:01 danymat

For anyone wanting to take this, see https://github.com/rose-pine/neovim/commit/ceb8d53bc3fa9150d57af3086ae1e5ae8057a428

The solution that comes to mind is noted in the comments of that file. Basically we provide defaults that the user can require and set in their own bufferline config.

mvllow avatar Jan 22 '22 03:01 mvllow

At the moment it seems the bufferline dev does not want to support themes overriding colors (https://github.com/akinsho/bufferline.nvim/issues/320). Will revisit if/when that changes

mvllow avatar Feb 07 '22 16:02 mvllow

Hi 👋🏿 ,

So I actually like the idea of creating a consumable palette that a user can then pass themselves to setup.

FWIW for a bit of context (which might not be needed anymore) I designed bufferline to work explicitly without tweaking by colorscheme authors. The exact painpoint/use case I had for creating this plugin (amongst other things) was that I wanted a zero color config bufferline that would just adapt whenever I changed my colorscheme. I didn't really intend for colorschemes to try to overwrite bufferline's highlights since I never actually publicised the highlight groups on purpose.

But the solution you have here where a colorscheme author can export a palette which a user could then just pass to bufferline seems like a good solution since it would allow users to opt into the colorschemes modifications but not have them happen automatically.

I'll think a bit more about if that's a good compromise and add a section on that to the README/or help docs.

akinsho avatar Feb 08 '22 09:02 akinsho

Appreciate the explanation 😌 I think your reasoning for not wanting themes to automatically override bufferline highlights is perfectly valid. I will look into adding back/finishing an exportable palette.

Personally, I love when you don't have to customise things. I'd prefer Rosé Pine to have no options but unlike other editors, this community has widely different environments and use cases that make some options necessary.

mvllow avatar Feb 08 '22 13:02 mvllow

One other solution could be adding custom highlight groups for themes to override only if the user sets themeable = true for example. The benefit to this is to ensure colours are always in sync. I'm having this issue now with lualine where sometimes it will match our dark variant except for some elements will still be in our light variant. Having highlight groups should allow colours to stay up to update.

mvllow avatar Feb 08 '22 13:02 mvllow

@mvllow that's an interesting suggestion i.e a set of highlights exposed explicitly for colorschemes to override and otherwise if false they'll be hidden and non default 🤔. Will explore that option when I get a chance since it will be more automatic although it might break revisiting setups

akinsho avatar Feb 08 '22 13:02 akinsho

@mvllow I've added a new PR https://github.com/akinsho/bufferline.nvim/pull/329 to bufferline that implements the themable option which allows highlights to be default if a user has set that to true. I've noted there though that all bufferline's highlights are created dynamically so even if they are set to default the names could still change in the future as features get added or removed, so it is much safer/preferable to focus on ensure the base highlights it depends on from nvim are set as desired and then allow bufferline to handle the rest rather than trying to change any specific dynamically generated highlights. Obviously you are free to do this, but there is no guarantee that there won't be breakages.

akinsho avatar Feb 26 '22 12:02 akinsho

bufferline shows me that it has deprecated values

Using `gui`, `guifg`, `guibg`, `guisp` is deprecated please, convert these as follows:
- guifg -> fg
- guibg -> bg
- guisp -> sp
- gui -> underline = true, undercurl = true, italic = true
 see :help bufferline-highlights for more details on how to update your highlights
Please fix:
- buffer_visible
- buffer_visible
- buffer_selected
- buffer_selected

I will make the corrections and send PR

Pkcarreno avatar Oct 24 '22 16:10 Pkcarreno