emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106894: color.el (color-name-to-rgb)


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106894: color.el (color-name-to-rgb): Use the white color to find the max color component value and return correctly computed values.
Date: Thu, 19 Jan 2012 23:06:49 +0000
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106894
author: Julien Danjou <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Thu 2012-01-19 23:06:49 +0000
message:
  color.el (color-name-to-rgb): Use the white color to find the max color 
component value and return correctly computed values.
   (color-name-to-rgb): Add missing float conversion for max value.
modified:
  lisp/ChangeLog
  lisp/color.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-01-19 10:38:31 +0000
+++ b/lisp/ChangeLog    2012-01-19 23:06:49 +0000
@@ -1,3 +1,9 @@
+2012-01-19  Julien Danjou  <address@hidden>
+
+       * color.el (color-name-to-rgb): Use the white color to find the max
+       color component value and return correctly computed values.
+       (color-name-to-rgb): Add missing float conversion for max value.
+
 2012-01-19  Martin Rudalics  <address@hidden>
 
        * window.el (window--state-get-1, window-state-get): Do not use

=== modified file 'lisp/color.el'
--- a/lisp/color.el     2012-01-05 09:46:05 +0000
+++ b/lisp/color.el     2012-01-19 23:06:49 +0000
@@ -53,7 +53,10 @@
 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 (float (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]