support config color scheme

This commit is contained in:
asep komarudin 2023-03-05 10:49:03 +07:00
parent ee7e49f922
commit b6f0601d3d
5 changed files with 181 additions and 42 deletions

View file

@ -1,4 +1,9 @@
local colorscheme = "gruvbox-baby"
local lst_style =
{ "sonokai", "sonokai_atlantis", "sonokai_andromeda", "sonokai_shusia", "sonokai_maia", "sonokai_espresso" }
local lst_material = { "material", "material_deepocean", "material_palenight", "material_lighter", "material_darker" }
local lst_onedark =
{ "onedark", "onedark_darker", "onedark_cool", "onedark_deep,onedark_warm", "onedark_warmer", "onedark_light" }
local data_exists, custom_ui = pcall(require, "custom.ui")
if data_exists then
if type(custom_ui) == "table" then
@ -17,6 +22,25 @@ if data_exists then
end
end
end
for _, v in pairs(lst_style) do
if v == colorscheme then
colorscheme = "sonokai"
break
end
end
for _, v in pairs(lst_material) do
if v == colorscheme then
colorscheme = "material"
break
end
end
for _, v in pairs(lst_onedark) do
if v == colorscheme then
colorscheme = "onedark"
break
end
end
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not status_ok then
local ok, _ = pcall(vim.cmd, "colorscheme " .. "gruvbox-baby")