~edwargix/emacs.d

1cdb14ca0ec453d918683d9bdccd7dbe4c6d55e9 — David Florness 3 months ago 2c04619
add functions for switching themes and disabling all enabled themes
1 files changed, 20 insertions(+), 0 deletions(-)

M lisp/themes.el
M lisp/themes.el => lisp/themes.el +20 -0
@@ 26,3 26,23 @@
  (load-theme 'doom-one t t)
  (load-theme 'doom-one-light t t)
  (load-theme 'doom-vibrant t t))

(defun switch-theme (theme)
  ;; The (interactive ...) and subsequent (unless ...) code was copied from the
  ;; enable-theme function in custom.el.gz
  (interactive (list (intern
                      (completing-read
                       "Switch to custom theme: "
                       obarray (lambda (sym) (get sym 'theme-settings)) t))))
  (unless (custom-theme-p theme)
    (error "Undefined Custom theme %s" theme))
  ;; end of copied code

  (disable-current-themes)
  (enable-theme theme))

(defun disable-current-themes ()
  "disabled all currently-enabled themes"
  (interactive)
  (dolist (thm custom-enabled-themes)
    (disable-theme thm)))