local M = {} M.themes = { dark = { "seoulbones", "rosebones", "forestbones", "zenwritten", }, light = { "seoulbones", "vimbones", "rosebones", "forestbones", }, } M.current = { dark = 1, light = 1, } M.bg = "dark" M.cycle = function() M.current[M.bg] = M.current[M.bg] + 1 if M.current[M.bg] > #M.themes[M.bg] then M.current[M.bg] = 1 end M.set() end M.set = function() vim.o.background = M.bg local theme = M.themes[M.bg][M.current[M.bg]] vim.print("Switching to " .. theme) vim.g[theme .. "_compat"] = 1 vim.cmd.colorscheme(theme) -- make strings nonitalic local str_highlight = vim.api.nvim_get_hl(0, { name = "String", link = false }) vim.api.nvim_set_hl( 0, "String", { fg = str_highlight.fg, italic = false, force = true } ) -- make booleans nonitalic and bold local bool_highlight = vim.api.nvim_get_hl(0, { name = "Boolean", link = false }) vim.api.nvim_set_hl( 0, "Boolean", { fg = bool_highlight.fg, italic = false, bold = true, force = true } ) -- make normals in seoulbones darker if theme == "seoulbones" and M.bg == "dark" then local norm_highlight = vim.api.nvim_get_hl(0, { name = "Normal", link = false }) vim.api.nvim_set_hl( 0, "Normal", { fg = norm_highlight.fg, bg = "#313131", force = true } ) end end M.togglebg = function() M.bg = M.bg == "dark" and "light" or "dark" M.set() end ---@param theme string? ---@param bg "dark"|"light"|nil M.setup = function(theme, bg) vim.cmd("packadd zenbones.nvim") if bg then M.bg = bg end if theme then for i, th in ipairs(M.themes[M.bg]) do if th == theme then M.current[M.bg] = i break end end end M.set() vim.keymap.set("n", "", M.cycle, {}) vim.keymap.set("n", "", M.togglebg, {}) end return M