branch: externals/ef-themes
commit ae6e2a309635bcd5ff3ad651483edd2e71690316
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Abstract function to return current palette
---
ef-themes.el | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/ef-themes.el b/ef-themes.el
index 3373b13141..81563c6baa 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -940,13 +940,20 @@ Those are stored in `ef-themes-faces' and
;;; Use theme colors
+(defun ef-themes--current-theme-palette ()
+ "Return palette of active Ef theme, else produce `user-error'."
+ (if-let* ((themes (ef-themes--list-enabled-themes))
+ (palette (intern
+ (format "%s-palette"
+ (car themes)))))
+ palette
+ (user-error "No enabled Ef theme could be found")))
+
(defmacro ef-themes-with-colors (&rest body)
"Evaluate BODY with colors from current palette bound."
(declare (indent 0))
(let* ((sym (gensym))
- (palette (intern
- (format "%s-palette"
- (car (ef-themes--list-enabled-themes)))))
+ (palette (ef-themes--current-theme-palette))
(colors (mapcar #'car (symbol-value palette))))
`(let* ((c '((class color) (min-colors 256)))
(,sym ,palette)