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 override = require("core.utils").load_config().ui.hl_override
local colors = require("colors").get()
local ui = require("core.utils").load_config().ui
@ -167,7 +166,3 @@ if ui.transparency then
fg("TelescopeBorder", one_bg)
fg_bg("TelescopeResultsTitle", black, blue)
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 = {}
-- if theme given, load given theme if given, otherwise nvchad_theme
@ -27,12 +30,15 @@ M.init = function(theme)
else
pcall(vim.cmd, "colo " .. theme)
end
if #override ~= 0 then
package.loaded[override] = nil
require(override)
end
end
-- returns a table of colors for given or current theme
M.get = function(theme)
local colors = require("core.utils").load_config().ui.colors
if #colors ~= 0 then
return require(colors)
else