Skip to content

evelez7/auto-switch-theme.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

example.mp4

A simple plugin to automatically switch themes when the system theme changes.

This plugin simply creates an autocmd to listen for an OptionSet event on background. Neovim automatically updates background based on an OSC signal.

I created this plugin because similar ones do a lot of complex DBus stuff or duplicate what Neovim already does to determine whether or not the system changed themes. This only relies on Neovim's own internal updating.

Tested on macOS and Fedora GNOME.

Warning

Explicitly setting your background will cause Neovim to delete its own autocmd that detects a system theme change, which will break this plugin.

Setup

lazy.nvim example:

return {
  'evelez7/auto-switch-theme.nvim',
  opts = {
      light = 'dookie',
      dark = 'github-monochrome-solarized'
  }
}

Manual Toggle/Switch

If you'd like, you can manually toggle Neovim's theme regardless of the current system theme. That way, you can switch to your dark theme while your system is in light mode. The theme will still switch if there is a system theme change.

:AutoSwitchTheme

:AutoSwitchTheme toggle

About

Automatically switch colorscheme on system theme change

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages