lazy.nvim/lua/lazy/view/colors.lua

52 lines
851 B
Lua
Raw Normal View History

2022-11-21 06:25:21 +08:00
local M = {}
M.colors = {
Error = "Error",
H1 = "Title",
H2 = "Title",
Muted = "Comment",
Normal = "NormalFloat",
ProgressDone = {
bold = true,
default = true,
fg = "#ff007c",
},
ProgressTodo = "LineNr",
Special = "@punctuation.special",
}
2022-11-21 06:34:35 +08:00
M.did_setup = false
2022-11-21 06:25:21 +08:00
function M.set_hl()
for hl_group, opts in pairs(M.colors) do
if type(opts) == "string" then
2022-11-21 06:34:35 +08:00
opts = { link = opts }
2022-11-21 06:25:21 +08:00
end
opts.default = true
2022-11-21 06:34:35 +08:00
vim.api.nvim_set_hl(0, "Lazy" .. hl_group, opts)
2022-11-21 06:25:21 +08:00
end
end
function M.setup()
if M.did_setup then
return
end
M.did_setup = true
M.set_hl()
vim.api.nvim_create_autocmd("ColorScheme", {
callback = function()
M.set_hl()
end,
})
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
callback = function()
M.set_hl()
end,
})
end
return M