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

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

[nongnu] elpa/autothemer 378f8707bd: Add functions to insert a color and


From: ELPA Syncer
Subject: [nongnu] elpa/autothemer 378f8707bd: Add functions to insert a color and color-name
Date: Thu, 25 Aug 2022 03:58:11 -0400 (EDT)

branch: elpa/autothemer
commit 378f8707bdd944f19b6fd4544359e993c9113752
Author: jasonm23 <jasonm23@gmail.com>
Commit: jasonm23 <jasonm23@gmail.com>

    Add functions to insert a color and color-name
---
 autothemer.el | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/autothemer.el b/autothemer.el
index 04813e7b8d..a73304d6c2 100644
--- a/autothemer.el
+++ b/autothemer.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Jason Milkins <jasonm23@gmail.com>
 ;;
 ;; URL: https://github.com/jasonm23/autothemer
-;; Version: 0.2.8
+;; Version: 0.2.9
 ;; Package-Requires: ((dash "2.10.0") (emacs "26.1"))
 ;;
 ;;; License:
@@ -295,7 +295,7 @@ Otherwise, append NEW-COLUMN to every element of LISTS."
 
 (defun autothemer--current-theme-guard ()
   "Guard functions from executing when there's no current theme."
-  (when (null autothemer--current-theme)
+  (unless autothemer--current-theme
     (user-error "No current theme available. Evaluate an autotheme 
definition")))
 
 ;;; Get colors from theme palette
@@ -339,9 +339,25 @@ See also `autothemer--color-p', `autothemer--color-name', 
`autothemer--color-val
                                     ':foreground (readable-foreground-color 
color)))
                        name)))
           (autothemer--theme-colors autothemer--current-theme))))
-       (color-name (car (split-string selected " " t " "))))
+       (color-name (cadr (split-string selected " " t " "))))
     (autothemer--get-color color-name)))
 
+(defun autothemer-insert-color ()
+  "Interactively select and insert a color from the current autotheme palette."
+  (interactive)
+  (autothemer--current-theme-guard)
+  (let ((color (autothemer--color-value
+                 (autothemer--select-color "Insert a color: "))))
+    (insert color)))
+
+(defun autothemer-insert-color-name ()
+  "Interactively select and insert a color name from the current autotheme 
palette."
+  (interactive)
+  (autothemer--current-theme-guard)
+  (let ((color-name (autothemer--color-name
+                      (autothemer--select-color "Insert a color name: "))))
+    (insert (format"%s" color-name))))
+
 ;;; Helper Functions
 
 (defmacro autothemer--plist-bind (args plist &rest body)



reply via email to

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