diff --git a/init.el b/init.el index 2fc2119..7444b95 100644 --- a/init.el +++ b/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 ("" . ef-themes-toggle)) (use-package diminish