[gnus git] branch master updated: n0-17-471-g731c0e5 =1= color: make color-name-to-rgb work on all display system

Julien Danjou <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  731c0e590ea80d0eae78b2e7babb939cfd036bea (commit)
      from  0c575b4a5749c880bb6c9c2b00a690577b4005c2 (commit)


- Log -----------------------------------------------------------------
commit 731c0e590ea80d0eae78b2e7babb939cfd036bea
Author: Julien Danjou <[email protected]>
Date:   Thu Jan 19 13:50:00 2012 +0100

    color: make color-name-to-rgb work on all display system
    
    Signed-off-by: Julien Danjou <[email protected]>

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e284cb8..d1a7da4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-19  Julien Danjou  <[email protected]>
+
+	* color.el (color-name-to-rgb): Use the white color to find the max
+	color component value and return correctly computed values.
+
 2012-01-10  Teodor Zlatanov  <[email protected]>
 
 	* nntp.el (nntp-send-authinfo): Query `auth-source-search' with the
diff --git a/lisp/color.el b/lisp/color.el
index ff7f0ee..3112e0d 100644
--- a/lisp/color.el
+++ b/lisp/color.el
@@ -53,7 +53,10 @@ numbers, (RED GREEN BLUE), each between 0.0 and 1.0 inclusive.
 Optional arg FRAME specifies the frame where the color is to be
 displayed.  If FRAME is omitted or nil, use the selected frame.
 If FRAME cannot display COLOR, return nil."
-  (mapcar (lambda (x) (/ x 65535.0)) (color-values color frame)))
+  ;; `colors-values' maximum value is either 65535 or 65280 depending on the
+  ;; display system. So we use a white conversion to get the max value.
+  (let ((valmax (car (color-values "#ffffff"))))
+    (mapcar (lambda (x) (/ x valmax)) (color-values color frame))))
 
 (defun color-rgb-to-hex  (red green blue)
   "Return hexadecimal notation for the color RED GREEN BLUE.

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    5 +++++
 lisp/color.el  |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.