I wondered if anyone has come up with a nice way of toggling colors with feline.nvim when changing their color scheme/theme?
Right now I have a hacked up method that reloads my feline config when the theme changes (via an autocommand), including loading of colors. But this only seems to work a couple of times before stopping altogether:
For reference, my relevant code is:
--statusline.lua file
local M = {}
-- Load the correct colour palette
local function load_colors()
local colors = require('themes')
if vim.g.theme == 'onedark' then
return colors.onedark
else
return colors.onelight
end
end
-- Setup our feline statusline
function M.__load()
M.colors = load_colors()
-- Set our components here
-- Omitted from this example but included a link below!
require('feline').setup({
preset = 'noicon',
default_fg = M.colors.fg,
default_bg = M.colors.bg,
vi_mode_colors = M.vi_mode_colors,
components = M.components,
properties = M.properties
})
end
return M
--autocmds.lua file
if pcall(require, 'feline') then
utils.augroup({refresh_statusline_colors = {{'ColorScheme', '*', "lua require('plugins.configs.statusline').__load()"}}})
end
I wondered if anyone has come up with a nice way of toggling colors with feline.nvim when changing their color scheme/theme?
Right now I have a hacked up method that reloads my feline config when the theme changes (via an autocommand), including loading of colors. But this only seems to work a couple of times before stopping altogether:
For reference, my relevant code is:
My full feline config can be found here, FYI.