all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 25890@debbugs.gnu.org, Rasmus <rasmus@gmx.us>
Subject: bug#25890: `color-values` gives wrong value
Date: Wed, 01 Mar 2017 00:42:02 +0100	[thread overview]
Message-ID: <87vartx4qd.fsf@drachen> (raw)
In-Reply-To: <8337eypb5l.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 28 Feb 2017 17:50:30 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

> So I think the patch below is what is needed to fix this problem.  Can
> you try it?  (There's one user of the functions the patch changes,
> shr-color.el, which will need to be adapted to the change, if we
> decide to install it.)
>
>
> --- lisp/color.el~0	2017-01-02 06:25:09.000000000 +0200
> +++ lisp/color.el	2017-02-28 17:35:43.570586100 +0200
> @@ -52,14 +52,14 @@
>  If FRAME cannot display COLOR, return nil."
>    ;; `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")))))
> +  (let ((valmax (float (car (color-values "#ffffffffffff")))))
>      (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.
>  RED, GREEN, and BLUE should be numbers between 0.0 and 1.0, inclusive."
> -  (format "#%02x%02x%02x"
> -          (* red 255) (* green 255) (* blue 255)))
> +  (format "#%04x%04x%04x"
> +          (* red 65535) (* green 65535) (* blue 65535)))
>  
>  (defun color-complement (color-name)
>    "Return the color that is the complement of COLOR-NAME.

With that patch, for me in the recipe of bug #24273, it makes a
difference; now

(color-name-to-rgb "#ffffff")
==>
(0.9961089494163424 0.9961089494163424 0.9961089494163424)

and

(color-name-to-rgb "white")
==>
(1.0 1.0 1.0)


For the recipe of this bug report, the values are the same as without
the patch.

I guess this is what you expected.  But is it ok that "#ffffff" is not
equivalent to "white"?  If it is, seems there is no inconsistency left.


Thanks so far,

Michael.





  reply	other threads:[~2017-02-28 23:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 14:05 bug#25890: 26.0.50; `color-values` gives wrong value Rasmus
2017-02-27 15:51 ` Eli Zaretskii
2017-02-27 17:09   ` bug#25890: " Rasmus
2017-02-27 23:36   ` bug#25890: 26.0.50; " Michael Heerdegen
2017-02-28  9:44     ` bug#25890: " Rasmus
2017-02-28 15:50       ` Eli Zaretskii
2017-02-28 23:42         ` Michael Heerdegen [this message]
2017-02-28 23:54           ` Drew Adams
2017-03-03 14:16             ` Eli Zaretskii
2017-03-01  3:43           ` Eli Zaretskii
2017-03-01  9:55         ` Rasmus
2017-03-03 14:08           ` Eli Zaretskii
2017-03-04 14:24             ` Simen Heggestøyl
2017-03-04 14:38               ` Eli Zaretskii
2017-03-04 15:44                 ` Lars Ingebrigtsen
2017-03-04 16:15                   ` Eli Zaretskii
2017-03-10  5:23 ` mail
2017-03-10  7:28   ` Eli Zaretskii
2017-03-10  8:13     ` mail
2017-03-10  8:33       ` mail
2017-03-10  9:28         ` Eli Zaretskii
2017-03-11 10:06           ` mail
2017-03-10  9:25       ` Eli Zaretskii
2017-03-10 11:07         ` Lars Ingebrigtsen
2017-03-10 13:32           ` Eli Zaretskii
2017-03-11 10:08             ` mail
2017-03-29 20:01 ` bug#25890: Default value of digits-per-component? Clément Pit-Claudel
2017-03-30  2:36   ` Eli Zaretskii
2017-03-30  3:10     ` Clément Pit-Claudel
     [not found] <<87zih7n2yt.fsf@pank.eu>
     [not found] ` <<83r32jpr8b.fsf@gnu.org>
     [not found]   ` <<87bmtnryqr.fsf@drachen>
     [not found]     ` <<87d1e2tzt5.fsf@pank.eu>
     [not found]       ` <<8337eypb5l.fsf@gnu.org>
     [not found]         ` <<87vartx4qd.fsf@drachen>
     [not found]           ` <<56bad9de-8111-4962-a9e9-2dbf0084e004@default>
     [not found]             ` <<83wpc6la28.fsf@gnu.org>
2017-03-03 15:49               ` bug#25890: `color-values` gives wrong value Drew Adams
2017-03-03 18:32                 ` Eli Zaretskii
     [not found] <<<87zih7n2yt.fsf@pank.eu>
     [not found] ` <<<83r32jpr8b.fsf@gnu.org>
     [not found]   ` <<<87bmtnryqr.fsf@drachen>
     [not found]     ` <<<87d1e2tzt5.fsf@pank.eu>
     [not found]       ` <<<8337eypb5l.fsf@gnu.org>
     [not found]         ` <<<87vartx4qd.fsf@drachen>
     [not found]           ` <<<56bad9de-8111-4962-a9e9-2dbf0084e004@default>
     [not found]             ` <<<83wpc6la28.fsf@gnu.org>
     [not found]               ` <<2cfd6280-34de-4751-b35f-ec7d47a16595@default>
     [not found]                 ` <<83pohyky8i.fsf@gnu.org>
2017-03-03 19:20                   ` Drew Adams
2017-03-03 19:27                     ` Eli Zaretskii
     [not found] <<<<87zih7n2yt.fsf@pank.eu>
     [not found] ` <<<<83r32jpr8b.fsf@gnu.org>
     [not found]   ` <<<<87bmtnryqr.fsf@drachen>
     [not found]     ` <<<<87d1e2tzt5.fsf@pank.eu>
     [not found]       ` <<<<8337eypb5l.fsf@gnu.org>
     [not found]         ` <<<<87vartx4qd.fsf@drachen>
     [not found]           ` <<<<56bad9de-8111-4962-a9e9-2dbf0084e004@default>
     [not found]             ` <<<<83wpc6la28.fsf@gnu.org>
     [not found]               ` <<<2cfd6280-34de-4751-b35f-ec7d47a16595@default>
     [not found]                 ` <<<83pohyky8i.fsf@gnu.org>
     [not found]                   ` <<d73ecee8-1b1d-4739-b2b8-e3eb9ecc3ce0@default>
     [not found]                     ` <<83o9xikvop.fsf@gnu.org>
2017-03-03 21:18                       ` Drew Adams
2017-03-04  8:43                         ` Eli Zaretskii
     [not found] <<<<<87zih7n2yt.fsf@pank.eu>
     [not found] ` <<<<<83r32jpr8b.fsf@gnu.org>
     [not found]   ` <<<<<87bmtnryqr.fsf@drachen>
     [not found]     ` <<<<<87d1e2tzt5.fsf@pank.eu>
     [not found]       ` <<<<<8337eypb5l.fsf@gnu.org>
     [not found]         ` <<<<<87vartx4qd.fsf@drachen>
     [not found]           ` <<<<<56bad9de-8111-4962-a9e9-2dbf0084e004@default>
     [not found]             ` <<<<<83wpc6la28.fsf@gnu.org>
     [not found]               ` <<<<2cfd6280-34de-4751-b35f-ec7d47a16595@default>
     [not found]                 ` <<<<83pohyky8i.fsf@gnu.org>
     [not found]                   ` <<<d73ecee8-1b1d-4739-b2b8-e3eb9ecc3ce0@default>
     [not found]                     ` <<<83o9xikvop.fsf@gnu.org>
     [not found]                       ` <<1b96dc61-19bb-486b-a408-c3b3c15e113b@default>
     [not found]                         ` <<83lgsll9ey.fsf@gnu.org>
2017-03-04 15:38                           ` Drew Adams
2017-03-04 16:10                             ` Eli Zaretskii
     [not found] <<<<<<87zih7n2yt.fsf@pank.eu>
     [not found] ` <<<<<<83r32jpr8b.fsf@gnu.org>
     [not found]   ` <<<<<<87bmtnryqr.fsf@drachen>
     [not found]     ` <<<<<<87d1e2tzt5.fsf@pank.eu>
     [not found]       ` <<<<<<8337eypb5l.fsf@gnu.org>
     [not found]         ` <<<<<<87vartx4qd.fsf@drachen>
     [not found]           ` <<<<<<56bad9de-8111-4962-a9e9-2dbf0084e004@default>
     [not found]             ` <<<<<<83wpc6la28.fsf@gnu.org>
     [not found]               ` <<<<<2cfd6280-34de-4751-b35f-ec7d47a16595@default>
     [not found]                 ` <<<<<83pohyky8i.fsf@gnu.org>
     [not found]                   ` <<<<d73ecee8-1b1d-4739-b2b8-e3eb9ecc3ce0@default>
     [not found]                     ` <<<<83o9xikvop.fsf@gnu.org>
     [not found]                       ` <<<1b96dc61-19bb-486b-a408-c3b3c15e113b@default>
     [not found]                         ` <<<83lgsll9ey.fsf@gnu.org>
     [not found]                           ` <<59441882-425e-4962-8760-70c505d991dd@default>
     [not found]                             ` <<83lgslja4t.fsf@gnu.org>
2017-03-04 20:40                               ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vartx4qd.fsf@drachen \
    --to=michael_heerdegen@web.de \
    --cc=25890@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.