feat: add theme handling

This commit is contained in:
johannes committed 2026-11-05 15:12:56 +01:00
1 parent 9b0446c5f6
commit 0d9335a7b0
4 files changed
+128 -8

No files matched your search

+27 -7
View File
@@ -1,12 +1,14 @@
-- All three installed; only the active one loads. lazy.nvim loads the others
-- on :colorscheme.
local schemes = { "catppuccin", "tokyonight", "kanagawa" }
-- All installed; only the active one loads, lazy.nvim loads the others on :colorscheme.
-- On the Linux desktop theme-apply.nu drives the colorscheme (see core/theme.lua);
-- without that file auto-dark-mode follows the system appearance.
local theme = require("core.theme")
local schemes = { "catppuccin", "tokyonight", "rose-pine", "kanagawa" }
local function cycle()
local current = vim.g.colors_name or ""
local idx = 1
for i, name in ipairs(schemes) do
if current:find("^" .. name) then
if vim.startswith(current, name) then
idx = i
end
end
@@ -24,11 +26,29 @@ return {
init = function()
vim.keymap.set("n", "<leader>tc", cycle, { desc = "Cycle colorscheme" })
end,
config = function()
require("catppuccin").setup({})
vim.cmd.colorscheme("catppuccin")
opts = {
flavour = "auto",
background = { light = "latte", dark = "mocha" },
},
config = function(_, opts)
require("catppuccin").setup(opts)
theme.setup()
end,
},
{ "folke/tokyonight.nvim", lazy = true },
{ "rose-pine/neovim", name = "rose-pine", lazy = true },
{ "rebelot/kanagawa.nvim", lazy = true },
{
"f-person/auto-dark-mode.nvim",
lazy = false,
cond = not theme.has_external(),
opts = {
set_dark_mode = function()
theme.set_background("dark")
end,
set_light_mode = function()
theme.set_background("light")
end,
},
},
}