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

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

[elpa] externals/svg-lib 4dbb49bda3 2/5: svg-lib-icon: Don't draw backgr


From: ELPA Syncer
Subject: [elpa] externals/svg-lib 4dbb49bda3 2/5: svg-lib-icon: Don't draw background if `:background` is nil
Date: Wed, 22 Nov 2023 03:58:38 -0500 (EST)

branch: externals/svg-lib
commit 4dbb49bda3ed8c3b73a81c1a2bc28ee6ee99f8d8
Author: hedy <hedy@tilde.cafe>
Commit: hedy <hedy@tilde.cafe>

    svg-lib-icon: Don't draw background if `:background` is nil
---
 svg-lib.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/svg-lib.el b/svg-lib.el
index ccf1572445..5b49c56c51 100644
--- a/svg-lib.el
+++ b/svg-lib.el
@@ -212,10 +212,11 @@ to the default face)."
   "Convert Emacs COLOR-NAME to #rrggbb form.
 If COLOR-NAME is unknown to Emacs, then return COLOR-NAME as-is."
   
-  (let ((rgb-color (color-name-to-rgb color-name)))
-    (if rgb-color
-        (apply #'color-rgb-to-hex (append rgb-color '(2)))
-      color-name)))
+  (when color-name
+    (let ((rgb-color (color-name-to-rgb color-name)))
+      (if rgb-color
+          (apply #'color-rgb-to-hex (append rgb-color '(2)))
+       color-name))))
 
 
 ;; SVG Library style build from partial specification
@@ -528,11 +529,12 @@ given STYLE and style elements ARGS."
     (when (>= stroke 0.25)
       (svg-rectangle svg box-x box-y box-width box-height
                      :fill foreground :rx radius))
-    (svg-rectangle svg (+ box-x (/ stroke 2.0))
-                       (+ box-y (/ stroke 2.0))
-                       (- box-width stroke)
-                       (- box-height stroke)
-                       :fill background :rx (- radius (/ stroke 2.0)))
+    (when background
+      (svg-rectangle svg (+ box-x (/ stroke 2.0))
+                     (+ box-y (/ stroke 2.0))
+                     (- box-width stroke)
+                     (- box-height stroke)
+                     :fill background :rx (- radius (/ stroke 2.0))))
     
     (dolist (item (xml-get-children (car root) 'path))
       (let* ((attrs (xml-node-attributes item))



reply via email to

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