gruvbox-material icon indicating copy to clipboard operation
gruvbox-material copied to clipboard

[Feature Request] File Explorer Shading

Open AlexvZyl opened this issue 2 years ago • 7 comments

Hi there, thanks for the awesome theme.

I would like to suggest an option for shading the window of the file explorer (or in this case, nvim-tree.lua). It would add a nice touch to the theme. An example can be seen over at nightfox.nvim.

AlexvZyl avatar Sep 03 '22 14:09 AlexvZyl

Here I am using toggleterm.nvim which shades the terminal.

image

AlexvZyl avatar Sep 03 '22 14:09 AlexvZyl

Just so I understand correctly, by shading you mean making the background of the file explorer darker than the default background, right?

antoineco avatar Sep 05 '22 17:09 antoineco

Yes that is exactly what I mean.

AlexvZyl avatar Sep 05 '22 18:09 AlexvZyl

@Alex-vZyl I'm looking into this. So far I haven't found a way to do it without autocmds and window-local highlights (only supported in Neovim), but I may have overlooked something. I'll keep you posted.

antoineco avatar Sep 07 '22 07:09 antoineco

@Alex-vZyl OK, I found a much simpler way. It turns out nvim-tree provides all the highlighting groups needed to override its background color without relying on window-local highlights.

Could you please add this to your Neovim config and let me know what you think about the result?

:page_facing_up: init.vim

" Apply custom highlights on colorscheme change.
" Must be declared before executing ':colorscheme'.
augroup custom_highlights_gruvboxmaterial
  autocmd!
  " file explorer background
  autocmd ColorScheme gruvbox-material 
  \       hi NvimTreeNormal      guibg=#181818 |
  \       hi NvimTreeEndOfBuffer guibg=#181818
augroup END

colorscheme gruvbox-material

:page_facing_up: init.lua

-- Apply custom highlights on colorscheme change.
-- Must be declared before executing ':colorscheme'.
grpid = vim.api.nvim_create_augroup('custom_highlights_gruvboxmaterial', {})
vim.api.nvim_create_autocmd('ColorScheme', {
  group = grpid,
  pattern = 'gruvbox-material',
  command = -- file explorer background
            'hi NvimTreeNormal      guibg=#181818 |' ..
            'hi NvimTreeEndOfBuffer guibg=#181818'
})

vim.cmd'colorscheme gruvbox-material'

image

Please bear in mind that #181818 is not in the color scheme's palette, and is only presented as an example.

antoineco avatar Sep 07 '22 09:09 antoineco

I'll add two new colors later, three plugins need to be optimized:

  • nvim-tree
  • bufferline
  • barbar

sainnhe avatar Sep 07 '22 09:09 sainnhe

@antoineco Here it is in my setup.

image

It works well! Definitely makes using file explorers inside neovim a lot nicer. It is a slightly different shade than what bufferline and toggleterm uses, but it is not that big of a deal. If you want you can support those plugins as well, but that is up to you.

AlexvZyl avatar Sep 07 '22 11:09 AlexvZyl

Is there any way we can make this shading feature optional? Not everyone likes it.

smartding avatar Nov 21 '22 12:11 smartding