A simple neovim plugin to automatically set the background color when system theme changes (only works on macOS now).
Use your favorite plugin manager, for example, with lazy.nvim
:
{
'wangl-cc/auto-bg.nvim',
event = 'UIEnter',
opts = {},
}
{
dark = {
pre = fun(): nil, -- function called before set background to dark
post = fun(): nil, -- function called after set background to dark
},
light = {
pre = fun(): nil, -- function called before set background to light
post = fun(): nil, -- function called after set background to light
},
}
This plugin is inspired by:
- bouk/dark-mode-notify: MIT license, the swift code based on this project is used to detect system theme changes.
- vimpostor/vim-lumen: GPL-3.0 license, the way to start a job to detect system theme changes inside neovim are learned from this project.
I suffered a big deley during startup when using vim-lumen (about 200ms).