- (if (eq 'xpm image-type)
- (setq image (create-image file 'xpm)
- width (image-size image)
- height (cdr width)
- width (car width))
- (with-temp-buffer
- (setq case-fold-search t)
- (insert-file-contents file)
- (goto-char (point-min))
- (re-search-forward "\
-^#define[[:blank:]]+[^[:blank:]]+_width[[:blank:]]+")
- (setq width (read (current-buffer)))
- (goto-char (point-min))
- (re-search-forward "\
-^#define[[:blank:]]+[^[:blank:]]+_height[[:blank:]]+")
- (setq height (read (current-buffer)))
- (search-forward "{")
- (delete-region (point-min) (point))
- (while (re-search-forward "[^0-9a-fx]+" nil t)
- (replace-match ""))
- (goto-char (point-min))
- (insert "\"")
- (while (search-forward "0x" nil t)
- (replace-match "\\\\x"))
- (goto-char (point-max))
- (insert "\"")
- (goto-char (point-min))
- (setq image (create-image (read (current-buffer))
- 'xbm t
- ':width width
- ':height height)
- width (/ (float width) (frame-char-width))
- height (/ (float height) (frame-char-height)))
- (let ((bg (face-background 'wl-highlight-logo-face))
- (fg (face-foreground 'wl-highlight-logo-face)))
- (when (stringp bg)
- (plist-put (cdr image) ':background bg))
- (when (stringp fg)
- (plist-put (cdr image) ':foreground fg)))))
+ (setq image (create-image file image-type)
+ width (image-size image)
+ height (cdr width)
+ width (car width))
+ (when (eq 'xbm image-type)
+ (let ((bg (face-background 'wl-highlight-demo-face))
+ (fg (face-foreground 'wl-highlight-demo-face)))
+ (when (stringp bg)
+ (plist-put (cdr image) ':background bg))
+ (when (stringp fg)
+ (plist-put (cdr image) ':foreground fg))))