fix: let hl_override be compatible with custom themes

load `hl_override` after the theme
This commit is contained in:
tuberry 2022-03-26 21:38:45 +08:00 committed by siduck
parent ec5017126c
commit 47e4f0361f
2 changed files with 8 additions and 7 deletions

View file

@ -1,6 +1,5 @@
local cmd = vim.cmd local cmd = vim.cmd
local override = require("core.utils").load_config().ui.hl_override
local colors = require("colors").get() local colors = require("colors").get()
local ui = require("core.utils").load_config().ui local ui = require("core.utils").load_config().ui
@ -167,7 +166,3 @@ if ui.transparency then
fg("TelescopeBorder", one_bg) fg("TelescopeBorder", one_bg)
fg_bg("TelescopeResultsTitle", black, blue) fg_bg("TelescopeResultsTitle", black, blue)
end end
if #override ~= 0 then
require(override)
end

View file

@ -1,3 +1,6 @@
local colors = require("core.utils").load_config().ui.colors
local override = require("core.utils").load_config().ui.hl_override
local M = {} local M = {}
-- if theme given, load given theme if given, otherwise nvchad_theme -- if theme given, load given theme if given, otherwise nvchad_theme
@ -27,12 +30,15 @@ M.init = function(theme)
else else
pcall(vim.cmd, "colo " .. theme) pcall(vim.cmd, "colo " .. theme)
end end
if #override ~= 0 then
package.loaded[override] = nil
require(override)
end
end end
-- returns a table of colors for given or current theme -- returns a table of colors for given or current theme
M.get = function(theme) M.get = function(theme)
local colors = require("core.utils").load_config().ui.colors
if #colors ~= 0 then if #colors ~= 0 then
return require(colors) return require(colors)
else else