ellisonleao / gruvbox.nvim

Lua port of the most famous vim colorscheme
MIT License
1.95k stars 210 forks source link

[BUG] Floating windows are not discernible when dim_inactive = true #316

Open miguelbarao opened 10 months ago

miguelbarao commented 10 months ago

Describe the bug

When dim_inactive = true, floating windows like Lazy and Mason have the background colors messed up. Opening a floating window sets both backgrounds of the front and back windows to the same color, making them indistinguishable. This happens with all three contrasts.

My configuration with lazy nvim is:

  {
    'ellisonleao/gruvbox.nvim',
    enabled = true,
    event = 'VeryLazy',
    lazy = true,
    keys = { '<F54>', '<Cmd>colorscheme gruvbox', desc = 'Gruvbox (colorscheme)' },
    priority = 1000, -- load before the other start plugins
    opts = {
      contrast = 'soft', -- 'hard', 'soft', ''
      dim_inactive = true,
      overrides = {
        -- NormalFloat = { bg = '#32302f' }, -- make floating windows discernible
        SignColumn = { bg = '#32302f' }, -- fix bg color
      },
    },
    config = function(_, opts)
      require('gruvbox').setup(opts)
      vim.keymap.set('n', '<F54>', '<Cmd>colorscheme gruvbox<CR>')
    end,
  },

Expected behaviour

The background color of the floating window should be set to a different contrast because it's "active".

Screenshots

No response

miguelbarao commented 1 week ago

Hi, There is a MasonNormal highlight that can be used to set the Mason background. It should be different depending on dim_inactive. The SignColumn background is also broken for git signs when dim_inactive=true.

Fix in the overrides:

  {
    'ellisonleao/gruvbox.nvim',
    enabled = true,
    event = 'VeryLazy',
    keys = { '<F54>', '<Cmd>colorscheme gruvbox', desc = 'Gruvbox (colorscheme)' },
    priority = 1000,     -- load before the other start plugins
    opts = {
      contrast = 'soft', -- 'hard', '', 'soft'
      dim_inactive = true,
      overrides = {
        -- NOTE: Mason window discernible with dim_inactive=true|false
        MasonNormal = { link = 'Normal'}, -- for: dim_inactive=true
        -- MasonNormal = { link = 'NormalFloat'}, -- for: dim_inactive=false

        -- FIX: gitsigns column background:
        GitSignsAdd = { link = "GruvboxGreenSign" },
        GitSignsChange = { link = "GruvboxOrangeSign" },
        GitSignsDelete = { link = "GruvboxRedSign" },
      },
    },
    config = function(_, opts)
      require('gruvbox').setup(opts)
      vim.keymap.set('n', '<F54>', '<Cmd>colorscheme gruvbox<CR>')
    end,
  },