fix: the highlights are not set correctly (#207)
This commit is contained in:
parent
2e916b4747
commit
b494d05c9d
@ -14,39 +14,32 @@ local M = {
|
||||
M.input_ns = api.nvim_create_namespace("avante_input")
|
||||
M.hint_ns = api.nvim_create_namespace("avante_hint")
|
||||
|
||||
local function has_set_colors(hl_group)
|
||||
local hl = api.nvim_get_hl(0, { name = hl_group })
|
||||
return next(hl) ~= nil
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
local normal = api.nvim_get_hl(0, { name = "Normal" })
|
||||
local normal_float = api.nvim_get_hl(0, { name = "NormalFloat" })
|
||||
|
||||
local has_set_colors = {}
|
||||
for _, hl_group in ipairs({
|
||||
M.TITLE,
|
||||
M.REVERSED_TITLE,
|
||||
M.SUBTITLE,
|
||||
M.REVERSED_SUBTITLE,
|
||||
M.THIRD_TITLE,
|
||||
M.REVERSED_THIRD_TITLE,
|
||||
}) do
|
||||
has_set_colors[hl_group] = api.nvim_get_hl(0, { name = hl_group }) ~= vim.empty_dict()
|
||||
end
|
||||
|
||||
if Config.behaviour.auto_set_highlight_group then
|
||||
if not has_set_colors[M.TITLE] then
|
||||
if not has_set_colors(M.TITLE) then
|
||||
api.nvim_set_hl(0, M.TITLE, { fg = "#1e222a", bg = "#98c379" })
|
||||
end
|
||||
if not has_set_colors[M.REVERSED_TITLE] then
|
||||
if not has_set_colors(M.REVERSED_TITLE) then
|
||||
api.nvim_set_hl(0, M.REVERSED_TITLE, { fg = "#98c379" })
|
||||
end
|
||||
if not has_set_colors[M.SUBTITLE] then
|
||||
if not has_set_colors(M.SUBTITLE) then
|
||||
api.nvim_set_hl(0, M.SUBTITLE, { fg = "#1e222a", bg = "#56b6c2" })
|
||||
end
|
||||
if not has_set_colors[M.REVERSED_SUBTITLE] then
|
||||
if not has_set_colors(M.REVERSED_SUBTITLE) then
|
||||
api.nvim_set_hl(0, M.REVERSED_SUBTITLE, { fg = "#56b6c2" })
|
||||
end
|
||||
if not has_set_colors[M.THIRD_TITLE] then
|
||||
if not has_set_colors(M.THIRD_TITLE) then
|
||||
api.nvim_set_hl(0, M.THIRD_TITLE, { fg = "#ABB2BF", bg = "#353B45" })
|
||||
end
|
||||
if not has_set_colors[M.REVERSED_THIRD_TITLE] then
|
||||
if not has_set_colors(M.REVERSED_THIRD_TITLE) then
|
||||
api.nvim_set_hl(0, M.REVERSED_THIRD_TITLE, { fg = "#353B45" })
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user