From 47e4f0361f3fd3428e2d194d113373256483ad14 Mon Sep 17 00:00:00 2001 From: tuberry <17917040+tuberry@users.noreply.github.com> Date: Sat, 26 Mar 2022 21:38:45 +0800 Subject: [PATCH] fix: let `hl_override` be compatible with custom themes load `hl_override` after the theme --- lua/colors/highlights.lua | 5 ----- lua/colors/init.lua | 10 ++++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lua/colors/highlights.lua b/lua/colors/highlights.lua index 1c3dae8..d9f2616 100644 --- a/lua/colors/highlights.lua +++ b/lua/colors/highlights.lua @@ -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 diff --git a/lua/colors/init.lua b/lua/colors/init.lua index b3917ca..a41533b 100644 --- a/lua/colors/init.lua +++ b/lua/colors/init.lua @@ -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