dotfiles/home/apps/neovim/after/plugin/auto-dark-mode.lua

28 lines
639 B
Lua
Raw Normal View History

local present, autodm = pcall(require, "auto-dark-mode")
2023-02-11 02:36:46 +01:00
if not (present and vim.fn.has("mac") == 1) then
return
end
2023-02-25 16:42:13 +01:00
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()