neanias / everforest-nvim

A Lua port of the Everforest colour scheme
273 stars 18 forks source link

Transparent background does not work in terminal #27

Closed Tekitori19 closed 3 months ago

Tekitori19 commented 3 months ago

Hi there,

I use Lazyvim and transparent background (it's work well) but my terminal in lazyvim doesn't transparent.

My config:


  {
    "neanias/everforest-nvim",
    config = function()
      require("everforest").setup({
       transparent_background_level = 1,
        diagnostic_virtual_text = "coloured",
        disable_terminal_colours = true,
        background = "soft",
        ui_contrast = "low",
      })
    end,
  },

My issues: image

Thank you so much ^-^

neanias commented 3 months ago

Hmm, that's interesting. Do you use a plugin for opening your terminal? What happens if you use :terminal without using the plugin?

Tekitori19 commented 3 months ago

It works fine on :terminal, but it can't be transparent on <C-/> (keymaps to turn on terminal in lazyvim) and also mason doesn't transparent too.

:terminal: image

<C-/> and mason: image image

neanias commented 3 months ago

I've done a bit of digging on this front. Both Mason and LazyVim use the NormalFloat highlight for their windows. NormalFloat doesn't use transparency to help the modals stand out from the windows they float over. If you'd like to have these windows be transparent, you'll need to override NormalFloat to be transparent, like so:

require("everforest").setup({
  -- <existing config here>
  on_highlights = function(hl, palette)
    hl.NormalFloat = { fg = palette.fg, bg = palette.none }
  end
})

NOTE: This highlight is used by a lot of other plugins so may produce some weird effects elsewhere

You can change MasonNormal instead of NormalFloat if you want it to be a bit more specific.

Tekitori19 commented 3 months ago

Thank you so much sir, your code fixed my issues. Have a nice day sir.