From 26c68031b330477890628d9982a694ff3464b896 Mon Sep 17 00:00:00 2001 From: Kaiz Khatri <24286590+ful1e5@users.noreply.github.com> Date: Thu, 5 Aug 2021 12:58:18 +0530 Subject: [PATCH] nested & `NONE` colors override added (#84) --- lua/tokyonight/util.lua | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lua/tokyonight/util.lua b/lua/tokyonight/util.lua index 882d64b..b13412b 100644 --- a/lua/tokyonight/util.lua +++ b/lua/tokyonight/util.lua @@ -245,18 +245,23 @@ end function util.color_overrides(colors, config) if type(config.colors) == "table" then for key, value in pairs(config.colors) do - if not colors[key] then - error("Color " .. key .. " does not exist") - end - if string.sub(value, 1, 1) == "#" then - -- hex override - colors[key] = value + if not colors[key] then error("Color " .. key .. " does not exist") end + + -- Patch: https://github.com/ful1e5/onedark.nvim/issues/6 + if type(colors[key]) == "table" then + util.color_overrides(colors[key], { colors = value }) else - -- another group - if not colors[value] then - error("Color " .. value .. " does not exist") + if value:lower() == "none" then + -- set to none + colors[key] = "NONE" + elseif string.sub(value, 1, 1) == "#" then + -- hex override + colors[key] = value + else + -- another group + if not colors[value] then error("Color " .. value .. " does not exist") end + colors[key] = colors[value] end - colors[key] = colors[value] end end end