Heaven and Hell - emacs package for easy toggling of light/dark color themes.
I constantly switch light and dark theme. When it's sunny outside, or I work in a very light room - I use the light theme. Otherwise, I prefer dark one. So I wrote a bunch of helpers which helped me with this and one day I decided to make a package out of it. Hope it'll be useful to anybody else. Cheers!
- Define your favorite light and dark themes
- Choose which one to run by default
- Switch between them with a single keypress
- Easily roll back to default emacs theme in case of messed faces
heaven-and-hell is available in Melpa.
use-package (including example config):
(use-package heaven-and-hell :ensure t :init (setq heaven-and-hell-theme-type 'dark) ;; Omit to use light by default (setq heaven-and-hell-themes '((light . tsdh-light) (dark . tsdh-dark))) ;; Themes can be the list: (dark . (tsdh-dark wombat)) ;; Optionall, load themes without asking for confirmation. (setq heaven-and-hell-load-theme-no-confirm t) :hook (after-init . heaven-and-hell-init-hook) :bind (("C-c <f6>" . heaven-and-hell-load-default-theme) ("<f6>" . heaven-and-hell-toggle-theme)))
First clone the repo:
git clone https://github.com/valignatev/heaven-and-hell.git your/site/elisp/path
Then add this in your
(require 'heaven-and-hell "your/site/elisp/path/heaven-and-hell/heaven-and-hell.el")
use-package configuration look above in installation section
;; Default is 'light (setq heaven-and-hell-theme-type 'dark) ;; Set preferred light and dark themes ;; default light is emacs default theme, default dark is wombat ;; Themes can be the list: (dark . (tsdh-dark tango-dark)) (setq heaven-and-hell-themes '((light . tsdh-light) (dark . tsdh-dark))) ;; Optionall, load themes without asking for confirmation. (setq heaven-and-hell-load-theme-no-confirm t) ;; Add init-hook so heaven-and-hell can load your theme (add-hook 'after-init-hook 'heaven-and-hell-init-hook) ;; Set keys to toggle theme and return to default emacs theme (global-set-key (kbd "C-c <f6>") 'heaven-and-hell-load-default-theme) (global-set-key (kbd "<f6>") 'heaven-and-hell-toggle-theme)
For Doom Emacs
;; In packages.el (package! heaven-and-hell) ;; In config.el (after! heaven-and-hell (setq heaven-and-hell-themes '((light . doom-one-light) (dark . doom-vibrant))) ;; Optionall, load themes without asking for confirmation. (setq heaven-and-hell-load-theme-no-confirm t) (map! :g "<f6>" 'heaven-and-hell-toggle-theme ;; Sometimes loading default theme is broken. I couldn't figured that out yet. :leader "<f6>" 'heaven-and-hell-load-default-theme)) (add-hook 'after-init-hook 'heaven-and-hell-init-hook)
Have trouble with installation? Found a bug? Want a new feature? Feel free to open an issue!
Want to fix a bug or add something new yourself? Feel free to submit pull request!
Also, don't hesitate to share it anywhere in the Internet :)