* gnus.el (gnus-group-startup-message): Prefer svg file and replace
authorAdam Sjøgren <asjo@koldfront.dk>
Tue, 29 Mar 2011 17:56:06 +0000 (19:56 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Tue, 29 Mar 2011 17:56:06 +0000 (19:56 +0200)
colors.
(gnus-splash-svg-color-symbols): New function.

lisp/ChangeLog
lisp/gnus.el

index ccc0eb0..8355e6c 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-29  Adam Sjøgren  <asjo@koldfront.dk>
+
+       * gnus.el (gnus-group-startup-message): Prefer svg file and replace
+       colors.
+       (gnus-splash-svg-color-symbols): New function.
+
 2011-03-29  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-sum.el (gnus-simplify-buffer-fuzzy): Take the regexp explicitly
index 83a8cf7..b63741d 100644 (file)
@@ -1042,12 +1042,15 @@ be set in `.emacs' instead."
                                          ((boundp 'image-load-path)
                                           (symbol-value 'image-load-path))
                                          (t load-path)))
-                  (image (find-image
-                          `((:type xpm :file "gnus.xpm"
+                  (image (gnus-splash-svg-color-symbols (find-image
+                          `((:type svg :file "gnus.svg"
+                                   :color-symbols
+                                   (("#bf9900" . ,(car gnus-logo-colors))
+                                    ("#ffcc00" . ,(cadr gnus-logo-colors))))
+                            (:type xpm :file "gnus.xpm"
                                    :color-symbols
                                    (("thing" . ,(car gnus-logo-colors))
                                     ("shadow" . ,(cadr gnus-logo-colors))))
-                            (:type svg :file "gnus.svg")
                             (:type png :file "gnus.png")
                             (:type pbm :file "gnus.pbm"
                                    ;; Account for the pbm's background.
@@ -1056,7 +1059,7 @@ be set in `.emacs' instead."
                             (:type xbm :file "gnus.xbm"
                                    ;; Account for the xbm's background.
                                    :background ,(face-foreground 'gnus-splash)
-                                   :foreground ,(face-background 'default))))))
+                                   :foreground ,(face-background 'default)))))))
              (when image
                (let ((size (image-size image)))
                  (insert-char ?\n (max 0 (round (- (window-height)
@@ -1102,6 +1105,20 @@ be set in `.emacs' instead."
     (setq mode-line-buffer-identification (concat " " gnus-version))
     (set-buffer-modified-p t)))
 
+(defun gnus-splash-svg-color-symbols (list)
+  "Do color-symbol search-and-replace in svg file"
+  (let ((type (plist-get (cdr list) :type))
+        (file (plist-get (cdr list) :file))
+        (color-symbols (plist-get (cdr list) :color-symbols)))
+    (if (and (string= type "svg"))
+        (let ((data (with-temp-buffer (insert-file file) (buffer-string))))
+          (mapc (lambda (rule)
+                  (setq data (replace-regexp-in-string
+                              (concat "fill:" (car rule))
+                              (concat "fill:" (cdr rule)) data))) color-symbols)
+          (cons (car list) (list :type type :data data)))
+       list)))
+
 (eval-when (load)
   (let ((command (format "%s" this-command)))
     (when (string-match "gnus" command)