2021-08-22 03:49:15 -04:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
-- if theme given, load given theme if given, otherwise nvchad_theme
|
|
|
|
M.init = function(theme)
|
|
|
|
if not theme then
|
|
|
|
theme = require("core.utils").load_config().ui.theme
|
|
|
|
end
|
|
|
|
|
|
|
|
-- set the global theme, used at various places like theme switcher, highlights
|
|
|
|
vim.g.nvchad_theme = theme
|
|
|
|
|
|
|
|
local present, base16 = pcall(require, "base16")
|
|
|
|
|
|
|
|
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"
|
2021-12-10 15:19:35 -05:00
|
|
|
end
|
2021-08-22 03:49:15 -04:00
|
|
|
end
|
|
|
|
|
2022-01-03 16:28:09 -05:00
|
|
|
-- returns a table of colors for given or current theme
|
2021-08-22 03:49:15 -04:00
|
|
|
M.get = function(theme)
|
|
|
|
if not theme then
|
|
|
|
theme = vim.g.nvchad_theme
|
|
|
|
end
|
|
|
|
|
2021-09-08 22:40:12 -04:00
|
|
|
return require("hl_themes." .. theme)
|
2021-08-22 03:49:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|