~edwargix/emacs.d

07bad1471aaa5e0a259278e4fc64998955fcbb45 — David Florness 8 months ago 0a02a3d
define a function for each theme with the help of a macro
1 files changed, 23 insertions(+), 18 deletions(-)

M lisp/themes.el
M lisp/themes.el => lisp/themes.el +23 -18
@@ 18,24 18,29 @@
  (disable-current-themes)
  (enable-theme theme))

(use-package gruvbox-theme
  :config
  (load-theme 'gruvbox-dark-hard t t)
  (load-theme 'gruvbox-light-hard t t))

(use-package monokai-theme
  :config
  (load-theme 'monokai t t))

(use-package doom-themes
  :config
  (load-theme 'doom-one t t)
  (load-theme 'doom-one-light t t)
  (load-theme 'doom-vibrant t t))

(use-package zenburn-theme
  :config
  (load-theme 'zenburn t t))
(defmacro use-theme (pkg themes)
  `(use-package ,pkg
     :config
     ;; load each theme
     ,@(cl-loop for thm in themes collect
                `(load-theme (quote ,thm) t t))
     ;; define an interactive function for each theme
     ,@(cl-loop for thm in themes collect
                `(defun ,(intern (format "%s-theme" thm)) ()
                   ,(format "Switch current theme to %s." thm)
                   (interactive)
                   (switch-theme (quote ,thm))))))

(use-theme gruvbox-theme (gruvbox-dark-hard
                          gruvbox-light-hard))

(use-theme monokai-theme (monokai))

(use-theme doom-themes (doom-one
                        doom-one-light
                        doom-vibrant))

(use-theme zenburn-theme (zenburn))

(defun dark-theme ()
  (interactive)