diff options
| author | Julien Danjou | 2012-01-19 23:06:49 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2012-01-19 23:06:49 +0000 |
| commit | 0d0deb382bfc139f4c30f1f17ef1ab410ff94836 (patch) | |
| tree | b42830135710aea1059a7dc389940794b6a6b5c1 /lisp | |
| parent | 1ef176814849c2c180ce80c65feb7af3ca3efa68 (diff) | |
| download | emacs-0d0deb382bfc139f4c30f1f17ef1ab410ff94836.tar.gz emacs-0d0deb382bfc139f4c30f1f17ef1ab410ff94836.zip | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/color.el | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8fa8031d125..ab813e21922 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-01-19 Julien Danjou <julien@danjou.info> | ||
| 2 | |||
| 3 | * color.el (color-name-to-rgb): Use the white color to find the max | ||
| 4 | color component value and return correctly computed values. | ||
| 5 | (color-name-to-rgb): Add missing float conversion for max value. | ||
| 6 | |||
| 1 | 2012-01-19 Martin Rudalics <rudalics@gmx.at> | 7 | 2012-01-19 Martin Rudalics <rudalics@gmx.at> |
| 2 | 8 | ||
| 3 | * window.el (window--state-get-1, window-state-get): Do not use | 9 | * window.el (window--state-get-1, window-state-get): Do not use |
diff --git a/lisp/color.el b/lisp/color.el index ff7f0eee4e6..6fab613ba69 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. | |||
| 53 | Optional arg FRAME specifies the frame where the color is to be | 53 | Optional arg FRAME specifies the frame where the color is to be |
| 54 | displayed. If FRAME is omitted or nil, use the selected frame. | 54 | displayed. If FRAME is omitted or nil, use the selected frame. |
| 55 | If FRAME cannot display COLOR, return nil." | 55 | If FRAME cannot display COLOR, return nil." |
| 56 | (mapcar (lambda (x) (/ x 65535.0)) (color-values color frame))) | 56 | ;; `colors-values' maximum value is either 65535 or 65280 depending on the |
| 57 | ;; display system. So we use a white conversion to get the max value. | ||
| 58 | (let ((valmax (float (car (color-values "#ffffff"))))) | ||
| 59 | (mapcar (lambda (x) (/ x valmax)) (color-values color frame)))) | ||
| 57 | 60 | ||
| 58 | (defun color-rgb-to-hex (red green blue) | 61 | (defun color-rgb-to-hex (red green blue) |
| 59 | "Return hexadecimal notation for the color RED GREEN BLUE. | 62 | "Return hexadecimal notation for the color RED GREEN BLUE. |