branch: externals/kind-icon
commit 94ff0ac04af7a7815db5e4269aabc68da1a8d5bc
Author: JD Smith <93749+jdtsm...@users.noreply.github.com>
Commit: JD Smith <93749+jdtsm...@users.noreply.github.com>

    customize interface for mappings
---
 kind-icon.el | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/kind-icon.el b/kind-icon.el
index ba7d6c8..36484a6 100644
--- a/kind-icon.el
+++ b/kind-icon.el
@@ -89,7 +89,18 @@ color string or a face from which we the :foreground
 face-property is taken. The background is automatically computed
 to lie between the background color and foreground (see
 `kind-icon-blend-frac')."
-  :type 'list)
+  :link '(url-link "https://materialdesignicons.com";)
+  :type '(repeat 
+         (list :tag "Mapping"
+               (symbol :tag "Kind")
+               (string :tag "Short-Text")
+               (plist :tag "Icon/Face options"
+                      :inline t
+                      :options
+                      ((:icon (string :tag "Icon Name"
+                                      :format "%t: %v"
+                                      :action kind-icon--preview))
+                       (:face (face :tag "Face")))))))
 
 (defcustom kind-icon-blend-frac 0.12
   "Fractional blend between foreground and background colors.
@@ -114,6 +125,14 @@ background color."
 See `svg-lib-style-compute-default'."
   :type 'plist)
 
+(defun kind-icon--preview (widget event)
+  (goto-char (field-end))
+  (let ((icon (buffer-substring (point) (field-end))))
+    (message "%S looks like: %s" icon
+            (propertize "**" 'display
+                        (apply #'svg-lib-icon
+                               icon nil kind-icon-default-style)))))
+
 (defsubst kind-icon--rgb-blend (rgb1 rgb2 frac)
   "Return a fractional blend between two colors RGB1 and RGB2.
 Each is a 3 element list.  The fractional blend point is the

Reply via email to