neanias / everforest-nvim

A Lua port of the Everforest colour scheme
233 stars 15 forks source link

Overriding Lualine Highlights #23

Closed iton0 closed 3 months ago

iton0 commented 3 months ago

I want to override the Lualine A section to use the highlight fg and bg of Lualine C. Am I getting the highlight group correctly in the code below

  on_highlights = function(highlight_groups, palette)
        highlight_groups.lualine_a_normal =
          { bg = palette.bg1, fg = palette.grey1 }
  end,
neanias commented 3 months ago

Hi there! Lualine is a bit of an edge case in this regard since it doesn't use the standard highlights. It uses everforest.lua as its highlights. There isn't anything in the plugin currently to handle this. I think the best way is to override it in your lualine config:

local everforest = require("everforest")
local colours = require("everforest.colours")
local everforest_lualine = require("lualine.themes.everforest") -- This may clash?

-- Instead of `everforest.config`, you can add in your own config here by using
-- `everforest.setup({ show_eob = false)` before you generate the palette.
local palette = colours.generate_palette(everforest.config, vim.o.background)

everforest_lualine.normal.a = { bg = palette.bg1, fg = palette.grey1 }

local lualine = require("lualine")
lualine.setup({
  options = { theme = everforest_lualine }
})
iton0 commented 3 months ago

This works beautifully. Thank you!