EdenEast / nightfox.nvim

🦊A highly customizable theme for vim and neovim with support for lsp, treesitter and a variety of plugins.
MIT License
2.86k stars 134 forks source link

bug: Inconsistent background colors in `lualine` and transparent background #421

Open acarril opened 3 months ago

acarril commented 3 months ago

Neovim version (nvim -v)

0.95

Operating system/version

MacOS 13.6.4 / Springdale Linux 9.2

Describe the bug

The theme's integration with lualine works well out of the box. Note that the lualine_c component has a background color that is darker than the theme's background:

image

However, when enabling background transparency (i.e. { options = { transparent = true } }), the lualine integration falls back to no background color for the lualine_c component:

image

I am reporting this as a bug as I believe that enabling background transparency should only affect highlight groups that have assigned the background color, and the lualine_c component should remain highlighted with a different color, regardless of background transparency.

However, this behavior seems to occur by design: lua/nightfox/util/lualine.lua defines a background color for this component that is empty if transparency is enabled: https://github.com/EdenEast/nightfox.nvim/blob/a408e6bb101066952b81de9c11be367114bd561f/lua/nightfox/util/lualine.lua#L8 https://github.com/EdenEast/nightfox.nvim/blob/a408e6bb101066952b81de9c11be367114bd561f/lua/nightfox/util/lualine.lua#L16-L20

Steps To Reproduce

  1. Install nightfox and lualine
  2. Set require('nightfox').setup({ { options = { transparent = true } } }) and require('lualine').setup()

Expected Behavior

The lualine_c component should remain highlighted with the same background color that it has when transparency is not enabled:

image

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
    {
        "EdenEast/nightfox.nvim",
        config = function()
            require("nightfox").setup({
                options = { transparent = true }, -- NOTE: toggle to `false` to compare
            })
            vim.cmd.colorscheme("nordfox")
        end,
    },
    -- add any other plugins here
    {
        "nvim-lualine/lualine.nvim",
        dependencies = { "nvim-tree/nvim-web-devicons" },
        config = function()
            require("lualine").setup()
        end,
    },
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})