emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ef-themes ae6e2a3096 251/281: Abstract function to retu


From: ELPA Syncer
Subject: [elpa] externals/ef-themes ae6e2a3096 251/281: Abstract function to return current palette
Date: Tue, 16 Aug 2022 16:58:38 -0400 (EDT)

branch: externals/ef-themes
commit ae6e2a309635bcd5ff3ad651483edd2e71690316
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]