Gnus development mailing list
 help / color / mirror / Atom feed
* Development splash smoothing
@ 2011-03-26 18:51 Adam Sjøgren
  2011-03-28  8:01 ` Julien Danjou
  2011-03-29 17:56 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Adam Sjøgren @ 2011-03-26 18:51 UTC (permalink / raw)
  To: ding

The splash screen in the development version has nice cautionary colours
- created by taking the .xpm version of the logo and adjusting the
colours:

 * http://koldfront.dk/misc/gnus/before.png

As can be seen, the .xpm version of the logo isn't quite as smooth as
the .svg version.

Ever so slightly annoying.

If you are like me, you'd like nice drawings even - or perhaps
especially - when you are on the bleeding edge.

I figured that ought to be possible to hack around - .svg is a text
format, after all...

So, here is a patch, hobbled together using Google and guessing. A lot.

It does make the splash screen look nicer, though:

 * http://koldfront.dk/misc/gnus/after.png

And the colours are replaced. Woo.

Let me know what you think, and please don't hesitate to tear my elisp
apart. I have no idea what I am doing.

  Best regards,

     Adam


[PATCH] Use the svg logo if present, and replace colors in it.

 * gnus.el (gnus-group-startup-message): Prefer svg file and replace colors.
   (gnus-splash-svg-color-symbols): New function.
---
 lisp/gnus.el |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/lisp/gnus.el b/lisp/gnus.el
index 83a8cf7..b63741d 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -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)
-- 
1.7.4.1

-- 
 "Ge mig en vinterdrog, ge mig allt du har                    Adam Sjøgren
  Kom nu jag är kroniskt låg, bara mörkret hörs"         asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-03-29 22:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-26 18:51 Development splash smoothing Adam Sjøgren
2011-03-28  8:01 ` Julien Danjou
2011-03-28 12:08   ` Adam Sjøgren
2011-03-29 17:56   ` Lars Magne Ingebrigtsen
2011-03-29 17:56 ` Lars Magne Ingebrigtsen
2011-03-29 21:16   ` Adam Sjøgren
2011-03-29 22:15     ` Lars Magne Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).