[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/icons 4de626ea22 08/11: Support using icons.el in toolbar
From: |
Stefan Kangas |
Subject: |
scratch/icons 4de626ea22 08/11: Support using icons.el in toolbar |
Date: |
Wed, 24 Aug 2022 02:40:44 -0400 (EDT) |
branch: scratch/icons
commit 4de626ea229f9237a2db69737d803a8ad65b6452
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefankangas@gmail.com>
Support using icons.el in toolbar
---
lisp/tool-bar.el | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index b1f7a70e33..4445c193a2 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -156,25 +156,32 @@ To define items in any other map, use
`tool-bar-local-item'."
(apply #'tool-bar-local-item icon def key tool-bar-map props)
(tool-bar--flush-cache))
+(defun tool-bar--image-expression-make-spec (type icon ext &optional colors)
+ (append (list :type type
+ :file (if (and (file-name-absolute-p icon)
+ (equal (file-name-extension icon) ext))
+ icon
+ (concat icon "." ext)))
+ colors))
+
(defun tool-bar--image-expression (icon)
"Return an expression that evaluates to an image spec for ICON."
(let* ((fg (face-attribute 'tool-bar :foreground))
(bg (face-attribute 'tool-bar :background))
(colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg))
(if (eq bg 'unspecified) nil (list :background bg))))
- (xpm-spec (list :type 'xpm :file (concat icon ".xpm")))
- (xpm-lo-spec (list :type 'xpm :file
- (concat "low-color/" icon ".xpm")))
- (pbm-spec (append (list :type 'pbm :file
- (concat icon ".pbm")) colors))
- (xbm-spec (append (list :type 'xbm :file
- (concat icon ".xbm")) colors)))
+ (xpm-spec (tool-bar--image-expression-make-spec 'xpm icon "xpm"))
+ (xpm-lo-spec (tool-bar--image-expression-make-spec
+ 'xpm (concat "low-color/" icon) "xpm"))
+ (pbm-spec (tool-bar--image-expression-make-spec 'pbm icon "pbm"
colors))
+ (xbm-spec (tool-bar--image-expression-make-spec 'xbm icon "xbm"
colors))
+ (svg-spec (tool-bar--image-expression-make-spec 'svg icon "svg"
colors)))
`(find-image (cond ((not (display-color-p))
- ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec))
+ ',(list svg-spec pbm-spec xbm-spec xpm-lo-spec
xpm-spec))
((< (display-color-cells) 256)
- ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec))
+ ',(list svg-spec xpm-lo-spec xpm-spec pbm-spec
xbm-spec))
(t
- ',(list xpm-spec pbm-spec xbm-spec)))
+ ',(list svg-spec xpm-spec pbm-spec xbm-spec)))
t)))
;;;###autoload
- branch scratch/icons created (now 8d103e622c), Stefan Kangas, 2022/08/24
- scratch/icons 4b7062e405 03/11: Factor out new function admin--read-root-directory, Stefan Kangas, 2022/08/24
- scratch/icons 09509f4fa1 05/11: Import Material design icons, Stefan Kangas, 2022/08/24
- scratch/icons 8d103e622c 11/11: Merge skicons.el with icons.el, Stefan Kangas, 2022/08/24
- scratch/icons 67251e79f7 09/11: Use material icons in mpc toolbar, Stefan Kangas, 2022/08/24
- scratch/icons 388745e6f7 04/11: New function to import the material icon set, Stefan Kangas, 2022/08/24
- scratch/icons c829fd9964 06/11: Support icons in compilation mode, Stefan Kangas, 2022/08/24
- scratch/icons 59c1097041 07/11: Require octicons and material, Stefan Kangas, 2022/08/24
- scratch/icons 4de626ea22 08/11: Support using icons.el in toolbar,
Stefan Kangas <=
- scratch/icons 6ad07cd620 01/11: New library icons.el adds support for icon sets, Stefan Kangas, 2022/08/24
- scratch/icons 3ba24c7103 02/11: Add new icon set "octicons", Stefan Kangas, 2022/08/24
- scratch/icons 647e04e6ca 10/11: Use material icons in main toolbar, Stefan Kangas, 2022/08/24