Files
dotfiles-and-setup/src_files/.config/nvim/lua/theme.lua
2025-10-12 22:42:32 -05:00

32 lines
1.1 KiB
Lua

local defaultColorScheme = "tokyodark"
-- local defaultColorScheme = "tokyonight-night"
-- local defaultColorScheme = "bamboo-vulgaris"
-- local defaultColorScheme = "rose-pine-main"
-- local defaultColorScheme = "gruvbox"
-- local defaultColorScheme = "slate"
-- local defaultColorScheme = "sorbet"
local ok, theme_specs = pcall(dofile, (os.getenv('DIR_CURRENT_THEME') or "") .. "/neovim.lua")
if not ok then
vim.notify(
'current theme file not found, using default: ' .. defaultColorScheme,
vim.log.levels.INFO
)
vim.cmd.colorscheme(defaultColorScheme)
return
end
local first = theme_specs[1]
local plugin_name = (type(first.name) == 'string' and first.name)
or (type(first[1]) == 'string' and first[1]:match('.*/(.*)'))
or 'plugin_name_not_found'
local last = theme_specs[#theme_specs]
local colorscheme = ((type(last.opts) == 'table' and type(last.opts.colorscheme) == 'string') and last.opts.colorscheme)
or plugin_name:gsub("%.%w+$", "")
colorscheme = (colorscheme == 'plugin_name_not_found' and defaultColorScheme)
or colorscheme
vim.cmd.colorscheme(colorscheme)