Hi, thanks for your useful library. I believe there is a feature that should be added to svg-lib-icon to make it more customizable.
kind-icon gives icons next to candidates in emacs completion popups, which are fetched with svg-lib-icon. It would be great to have this function support not drawing a background to the fetched icons, so that the resulting SVG icons can adapt to the popup background, depending on whether the user is currently selecting it.
See this issue: jdtsmith/kind-icon#38.
Below is the result currently, svg-lib-icon drawing a background on the "(x)" icon.
toggle
In the linked issue @jdtsmith also suggests a patch, which makes svg-lib-icon not draw a background if the user has set :background nil:
Here is what the popup would look like if svg-lib-icon supported transparency:
toggle
(both screenshots used are provided by jdtsmith)
I believe it would be a nice addition to svg-lib to support fetching transparent icons so packages that use svg-lib can have more extensibility, as I'm sure the transparency option would be useful for other packages too.
Hi, thanks for your useful library. I believe there is a feature that should be added to
svg-lib-icon
to make it more customizable.kind-icon gives icons next to candidates in emacs completion popups, which are fetched with
svg-lib-icon
. It would be great to have this function support not drawing a background to the fetched icons, so that the resulting SVG icons can adapt to the popup background, depending on whether the user is currently selecting it.See this issue: jdtsmith/kind-icon#38.
Below is the result currently, svg-lib-icon drawing a background on the "
(x)
" icon.toggle
In the linked issue @jdtsmith also suggests a patch, which makes
svg-lib-icon
not draw a background if the user has set:background nil
:toggle
```diff @@ -212,10 +212,11 @@ "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 @@ (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)) ```Here is what the popup would look like if
svg-lib-icon
supported transparency:toggle
(both screenshots used are provided by jdtsmith)I believe it would be a nice addition to svg-lib to support fetching transparent icons so packages that use svg-lib can have more extensibility, as I'm sure the transparency option would be useful for other packages too.