One dark and light colorscheme for neovim >= 0.5.0 written in lua based on Atom's One Dark and Light theme. Additionally, it comes with 5 color variant styles
Hey, how could I save the current theme set by toggling between sessions? I'm really new to the Neovim lua scripting and tried to solve this with the script below, without success:
-- -- Colorscheme configurations
local get_onedark_style = function()
if ONEDARK_STYLE == nil then
ONEDARK_STYLE = 'dark'
end
if ONEDARK_STYLE == 'dark' then
vim.o.background = 'dark'
end
if ONEDARK_STYLE == 'light' then
vim.o.background = 'light'
end
return ONEDARK_STYLE
end
local onedark_options = {
style = get_onedark_style(),
-- toggle theme style ---
toggle_style_key = '<leader>ts', -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
toggle_style_list = {'light', 'dark'}, -- List of styles to toggle between. The possible styles are {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}
}
require('onedark').setup(onedark_options)
require('onedark').load()
local save_onedark_style = function()
print(ONEDARK_STYLE)
if ONEDARK_STYLE == 'light' then
vim.o.background = 'dark'
ONEDARK_STYLE = 'dark'
elseif ONEDARK_STYLE == 'dark' then
vim.o.background = 'light'
ONEDARK_STYLE = 'light'
end
vim.cmd('wsh!')
end
vim.api.nvim_create_autocmd('ColorScheme', {
pattern = {'*'},
callback = save_onedark_style,
})
Hey, how could I save the current theme set by toggling between sessions? I'm really new to the Neovim lua scripting and tried to solve this with the script below, without success: