mirror of
https://github.com/gabehf/base46.git
synced 2026-03-09 07:28:50 -07:00
fix theme switcher not working
remove un-needed module
This commit is contained in:
parent
c6a9f4c533
commit
54b75c567e
2 changed files with 11 additions and 61 deletions
|
|
@ -1,49 +0,0 @@
|
|||
local merge_tb = require("base46").merge_tb
|
||||
|
||||
local ui = require("core.utils").load_config().ui
|
||||
local highlights = {}
|
||||
|
||||
-- push hl_dir file names to table
|
||||
local hl_files = vim.fn.stdpath "data" .. "/site/pack/packer/start/base46/lua/base46/integrations"
|
||||
|
||||
for _, file in ipairs(vim.fn.readdir(hl_files)) do
|
||||
local integration = require("base46.integrations." .. vim.fn.fnamemodify(file, ":r"))
|
||||
highlights = merge_tb(highlights, integration)
|
||||
end
|
||||
|
||||
-- polish theme specific highlights
|
||||
local polish_hl = require("base46").get_theme_tb "polish_hl"
|
||||
|
||||
if polish_hl then
|
||||
highlights = merge_tb(highlights, polish_hl)
|
||||
end
|
||||
|
||||
-- override user highlights if there are any
|
||||
local user_hl_override = vim.deepcopy(ui.hl_override)
|
||||
local user_hl_add = vim.deepcopy(ui.hl_add)
|
||||
local user_highlights = merge_tb(user_hl_override, user_hl_add)
|
||||
local colors = require("base46").get_theme_tb "base_30"
|
||||
|
||||
-- fg = "white" set by user becomes fg = colors["white"]
|
||||
-- so no need for the user to import colors
|
||||
|
||||
for group, _ in pairs(user_highlights) do
|
||||
for key, val in pairs(user_highlights[group]) do
|
||||
if key == "fg" or key == "bg" then
|
||||
if val:sub(1, 1) == "#" or val == "none" or val == "NONE" then
|
||||
user_highlights[group][key] = val
|
||||
else
|
||||
user_highlights[group][key] = colors[val]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
highlights = merge_tb(highlights, user_highlights)
|
||||
|
||||
-- local set_transparent = nvchad.load_config().ui.transparency
|
||||
if vim.g.transparency then
|
||||
highlights = merge_tb(highlights, require "base46.glassy")
|
||||
end
|
||||
|
||||
return highlights
|
||||
|
|
@ -23,18 +23,15 @@ M.merge_tb = function(table1, table2)
|
|||
end
|
||||
|
||||
M.load_all_highlights = function()
|
||||
vim.opt.bg = require("base46").get_theme_tb "type" -- dark/light
|
||||
|
||||
-- reload highlights for theme switcher
|
||||
local reload = require("plenary.reload").reload_module
|
||||
require("plenary.reload").reload_module "base46"
|
||||
|
||||
reload "base46.integrations"
|
||||
reload "base46.chadlights"
|
||||
M.compile()
|
||||
|
||||
local hl_groups = require "base46.chadlights"
|
||||
local hl_files = vim.fn.stdpath "data" .. "/site/pack/packer/start/base46_cache/lua/base46_cache"
|
||||
|
||||
for hl, col in pairs(hl_groups) do
|
||||
vim.api.nvim_set_hl(0, hl, col)
|
||||
for _, file in ipairs(vim.fn.readdir(hl_files)) do
|
||||
require("base46_cache." .. vim.fn.fnamemodify(file, ":r"))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -79,11 +76,13 @@ M.extend_default_hl = function(highlights)
|
|||
end
|
||||
end
|
||||
|
||||
local overriden_hl = M.turn_str_to_color(config.ui.hl_override)
|
||||
if config.ui.hl_override then
|
||||
local overriden_hl = M.turn_str_to_color(config.ui.hl_override)
|
||||
|
||||
for key, value in pairs(overriden_hl) do
|
||||
if highlights[key] then
|
||||
highlights[key] = M.merge_tb(highlights[key], value)
|
||||
for key, value in pairs(overriden_hl) do
|
||||
if highlights[key] then
|
||||
highlights[key] = M.merge_tb(highlights[key], value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue