mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 13:30:41 +00:00
37 lines
858 B
Lua
37 lines
858 B
Lua
|
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"
|
||
|
else
|
||
|
return false
|
||
|
end
|
||
|
end
|
||
|
|
||
|
-- returns a table of colors for givem or current theme
|
||
|
M.get = function(theme)
|
||
|
if not theme then
|
||
|
theme = vim.g.nvchad_theme
|
||
|
end
|
||
|
|
||
|
return require("colors.themes." .. theme)
|
||
|
end
|
||
|
|
||
|
return M
|