2019-08-06 14:45:55 -04:00
|
|
|
;;; core/autoload/themes.el -*- lexical-binding: t; -*-
|
2019-07-23 14:31:00 +02:00
|
|
|
|
2019-07-25 12:21:26 +02:00
|
|
|
(defun doom--custom-theme-set-face (spec)
|
|
|
|
(cond ((listp (car spec))
|
|
|
|
(cl-loop for face in (car spec)
|
2019-07-28 14:09:31 +02:00
|
|
|
collect
|
2019-09-15 02:09:58 +10:00
|
|
|
(car (doom--custom-theme-set-face (cons face (cdr spec))))))
|
2019-07-28 14:09:31 +02:00
|
|
|
((keywordp (cadr spec))
|
2019-07-25 12:21:26 +02:00
|
|
|
`((,(car spec) ((t ,(cdr spec))))))
|
|
|
|
(`((,(car spec) ,(cdr spec))))))
|
|
|
|
|
2019-07-23 14:31:00 +02:00
|
|
|
;;;###autoload
|
2019-10-24 19:42:07 -04:00
|
|
|
(defmacro custom-theme-set-faces! (theme &rest specs)
|
2019-07-25 12:21:26 +02:00
|
|
|
"Apply a list of face SPECS as user customizations for THEME.
|
2019-07-23 14:31:00 +02:00
|
|
|
|
|
|
|
THEME can be a single symbol or list thereof. If nil, apply these settings to
|
2019-07-28 14:10:25 +02:00
|
|
|
all themes. It will apply to all themes once they are loaded."
|
2019-10-24 19:42:07 -04:00
|
|
|
(declare (indent defun))
|
2019-10-27 14:27:29 -04:00
|
|
|
`(let ((fn (gensym "doom--customize-themes-h-")))
|
2019-10-24 19:42:07 -04:00
|
|
|
(fset
|
|
|
|
fn (lambda ()
|
2019-11-22 16:16:27 -05:00
|
|
|
(let (custom--inhibit-theme-enable)
|
|
|
|
(dolist (theme (doom-enlist (or ,theme 'user)))
|
|
|
|
(when (or (eq theme 'user)
|
|
|
|
(custom-theme-enabled-p theme))
|
|
|
|
(apply #'custom-theme-set-faces theme
|
|
|
|
(mapcan #'doom--custom-theme-set-face
|
|
|
|
(list ,@specs))))))))
|
2019-10-24 19:42:07 -04:00
|
|
|
(when (or doom-init-theme-p (null doom-theme))
|
|
|
|
(funcall fn))
|
|
|
|
(add-hook 'doom-load-theme-hook fn 'append)))
|
2019-07-23 14:31:00 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2019-10-24 19:42:07 -04:00
|
|
|
(defmacro custom-set-faces! (&rest specs)
|
2019-07-25 12:21:26 +02:00
|
|
|
"Apply a list of face SPECS as user customizations.
|
2019-07-23 14:31:00 +02:00
|
|
|
|
|
|
|
This is a drop-in replacement for `custom-set-face' that allows for a simplified
|
2019-07-28 14:10:25 +02:00
|
|
|
face format."
|
2019-10-24 19:42:07 -04:00
|
|
|
(declare (indent defun))
|
|
|
|
`(custom-theme-set-faces! 'user ,@specs))
|
2019-07-23 14:31:00 +02:00
|
|
|
|
2019-07-28 14:16:33 +02:00
|
|
|
(defvar doom--prefer-theme-elc)
|
2019-07-23 14:31:00 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defun doom/reload-theme ()
|
|
|
|
"Reload the current color theme."
|
|
|
|
(interactive)
|
|
|
|
(let ((theme (or (car-safe custom-enabled-themes) doom-theme)))
|
|
|
|
(when theme
|
|
|
|
(mapc #'disable-theme custom-enabled-themes))
|
2019-09-20 19:51:42 -04:00
|
|
|
(load-theme doom-theme 'noconfirm)
|
|
|
|
(doom/reload-font)))
|