branch: externals/doric-themes
commit 34e4742de265c512cacd1017985e232181968715
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Define macro doric-themes-with-colors
---
doric-themes.el | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/doric-themes.el b/doric-themes.el
index 1ccff779a0..8f8dacd0f5 100644
--- a/doric-themes.el
+++ b/doric-themes.el
@@ -1812,6 +1812,25 @@ default to a generic text that mentions the
BACKGROUND-MODE."
(list `(provide-theme ',name)))))
(error "No palette found for `%s'" name)))
+(defun doric-themes--with-colors-subr (&rest body)
+ "Evaluate BODY for `doric-themes-with-colors'."
+ (condition-case data
+ (when-let* ((theme (doric-themes--current-theme))
+ (palette-symbol (intern-soft (format "%s-palette" theme)))
+ (_ (boundp palette-symbol))
+ (palette (symbol-value palette-symbol)))
+ (eval
+ `(let (,@palette)
+ ,body)))
+ (error (message "Error in doric-themes-with-colors: %s" data))))
+
+;;;###autoload
+(defmacro doric-themes-with-colors (&rest body)
+ "Evaluate BODY with current Doric theme's palette `let' bound."
+ (declare (indent 0))
+ `(doric-themes--with-colors-subr
+ (lambda () ,@body)))
+
;;;; Add themes from package to path
;;;###autoload