From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: michael_heerdegen@web.de, 25890@debbugs.gnu.org, rasmus@gmx.us
Subject: bug#25890: `color-values` gives wrong value
Date: Fri, 3 Mar 2017 07:49:33 -0800 (PST) [thread overview]
Message-ID: <2cfd6280-34de-4751-b35f-ec7d47a16595@default> (raw)
In-Reply-To: <<83wpc6la28.fsf@gnu.org>>
> > > > (defun color-rgb-to-hex (red green blue)
> >
> > The function should accept an optional arg NB-DIGITS, which
> > specifies the number of hex digits for each of R, G, B. And
> > yes, it should default to 4 digits: #RRRRGGGGBBBB.
> >
> > (That's what the original function in hexrgb.el does, from
> > which color.el was supposedly derived.)
>
> The code in hexrgb.el produces strange results in this regard (e.g.,
> it produces "#FFFFFFFFE0E0" instead of "#FFFFFFFFE000" for the color
> mentioned by the OP).
Not clear what you are saying. What color mentioned by the OP?
Do you mean "light yellow"? What sexp using hexrgb.el did you try?
If I do (hexrgb-color-name-to-hex "light yellow") I do get
"#FFFFFFFFE0E0". That comes from `x-color-values' returning
(65535 65535 57568) and `hexrgb-int-to-hex' converting 57568
to "E0E0". That's from (format "%04X" 57568). Hex conversion
of decimal 57568 _should_ be E0E0, AFAIK. Where is the bug?
Or are you saying that the bug is from `x-color-values'
(`color-values') and not from hexrgb.el? Is 57568 the
wrong blue color value for "light yellow"?
> I believe that's because it interprets the
> conversion between 2 and 4 hex digits incorrectly: the 2 hex digits
> are the _most_ significant bits of the 4-digit version, not the LSB.
See above. I'm missing what you are trying to say, I guess.
Are you saying that color value 57568 should not be expressed
in hex as E0E0?
> But I did add such an optional argument to color-rgb-to-hex,
Good.
> with the difference that its value can only be either 4 or 2,
> as I see no reason for anyone to want a 12-bit per component
> color notations.
(I see no reason for the function not to be general. Sure,
for current applications of such a function to colors there
is no real need for such generality. But why prevent it?)
Anyway, thanks for adding the optional arg.
I'm interested in your reply to my questions above,
especially in the case that might have located a bug in
hexrgb.el. It's not clear to me, so far. Thx.
next parent reply other threads:[~2017-03-03 15:49 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 ` Drew Adams [this message]
2017-03-03 18:32 ` bug#25890: `color-values` gives wrong value 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
[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>
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>
2017-03-03 19:20 ` Drew Adams
2017-03-03 19:27 ` Eli Zaretskii
2017-02-27 14:05 bug#25890: 26.0.50; " 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
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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2cfd6280-34de-4751-b35f-ec7d47a16595@default \
--to=drew.adams@oracle.com \
--cc=25890@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=michael_heerdegen@web.de \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).