Automatically toggle light and dark theme with macOS system appearance
This commit is contained in:
parent
ef038da6ac
commit
efbc61c3d8
1 changed files with 8 additions and 0 deletions
8
init.el
8
init.el
|
@ -131,6 +131,14 @@
|
|||
(setq ef-themes-to-toggle '(ef-day ef-night))
|
||||
(mapc #'disable-theme custom-enabled-themes)
|
||||
(load-theme 'ef-night :no-confirm)
|
||||
(when (eq window-system 'ns)
|
||||
(defun dl/themes-toggle-with-system (appearance)
|
||||
"Load dark or light theme depending on system appearance on macOS."
|
||||
(mapc #'disable-theme custom-enabled-themes)
|
||||
(pcase appearance
|
||||
('light (load-theme 'ef-day :no-confirm))
|
||||
('dark (load-theme 'ef-night :no-confirm))))
|
||||
(add-hook 'ns-system-appearance-change-functions #'dl/themes-toggle-with-system))
|
||||
:bind ("<f12>" . ef-themes-toggle))
|
||||
|
||||
(use-package diminish
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue