|
|
|
@ -13,22 +13,34 @@ M.init = function(theme)
|
|
|
|
|
|
|
|
|
|
if present then
|
|
|
|
|
-- first load the base16 theme
|
|
|
|
|
base16(base16.themes(theme), true)
|
|
|
|
|
|
|
|
|
|
-- unload to force reload
|
|
|
|
|
package.loaded["colors.highlights" or false] = nil
|
|
|
|
|
-- then load the highlights
|
|
|
|
|
require "colors.highlights"
|
|
|
|
|
local ok, array = pcall(base16.themes, theme)
|
|
|
|
|
|
|
|
|
|
if ok then
|
|
|
|
|
base16(array, true)
|
|
|
|
|
-- unload to force reload
|
|
|
|
|
package.loaded["colors.highlights" or false] = nil
|
|
|
|
|
-- then load the highlights
|
|
|
|
|
require "colors.highlights"
|
|
|
|
|
else
|
|
|
|
|
pcall(vim.cmd, "colo " .. theme)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
pcall(vim.cmd, "colo " .. theme)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- returns a table of colors for given or current theme
|
|
|
|
|
M.get = function(theme)
|
|
|
|
|
if not theme then
|
|
|
|
|
theme = vim.g.nvchad_theme
|
|
|
|
|
local colors = require("core.utils").load_config().ui.colors
|
|
|
|
|
|
|
|
|
|
if #colors ~= 0 then
|
|
|
|
|
return require(colors)
|
|
|
|
|
else
|
|
|
|
|
if not theme then
|
|
|
|
|
theme = vim.g.nvchad_theme
|
|
|
|
|
end
|
|
|
|
|
return require("hl_themes." .. theme)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return require("hl_themes." .. theme)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|
|
|
|
|