dotfiles/home/apps/neovim/after/plugin/auto-dark-mode.lua
2023-02-25 16:42:13 +01:00

27 lines
639 B
Lua

local present, autodm = pcall(require, "auto-dark-mode")
if not (present and vim.fn.has("mac") == 1) then
return
end
local update_neovide_background = function()
if not vim.g.neovide then
return
end
local ctp_present, ctp = pcall(require, "catppuccin.palettes")
if ctp_present then
vim.g.neovide_background_color = ctp.get_palette().base
end
end
autodm.setup({
set_dark_mode = function()
vim.api.nvim_set_option("background", "dark")
update_neovide_background()
end,
set_light_mode = function()
vim.api.nvim_set_option("background", "light")
update_neovide_background()
end,
})
autodm.init()