fix(highlights): give user config higher priority (#306)

* fix(highlights): give user config higher priority

* Update lua/avante/highlights.lua

---------

Co-authored-by: Aaron Pham <Aaronpham0103@gmail.com>
This commit is contained in:
jkunlin 2024-08-28 23:44:57 +08:00 committed by GitHub
parent fc5f6754a5
commit 1c0623a9df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,13 +65,13 @@ M.conflict_highlights = function(opts)
opts = opts or Config.diff.highlights
local get_default_colors = function(key, hl)
--- We will first check for the hl name. If plugins set this then we won't use the default opts[var_accesor]
--- We will first check for user custom highlight. Then fallback to default name highlight.
local cl
cl = api.nvim_get_hl(0, { name = hl.name })
cl = api.nvim_get_hl(0, { name = opts[key:lower()] })
if cl ~= nil then
return cl.bg or hl.bg
end
cl = api.nvim_get_hl(0, { name = opts[key:lower()] })
cl = api.nvim_get_hl(0, { name = hl.name })
return cl.bg or hl.bg
end