all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tom@tromey.com, simon@polaris64.net, 41544@debbugs.gnu.org
Subject: bug#41544: 26.3; Possible incorrect results from color-distance
Date: Fri, 5 Jun 2020 17:50:47 +0200	[thread overview]
Message-ID: <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@acm.org> (raw)
In-Reply-To: <835zc5bsut.fsf@gnu.org>

5 juni 2020 kl. 14.27 skrev Eli Zaretskii <eliz@gnu.org>:

> There's some history to that: see bug#25890.

Thank you very much, that certainly gives some historical perspective!

> What bad results does this issue cause in practice?

The immediate bad result is that color-name-to-rgb returns a value that is (a) wrong and (b) outside the range of legal values for that function. Code calling it expect the value to be (a) correct and (b) within the range of legal values.

> (Btw, in a GUI session I see (0.0 0.0 1.0), so no problem there.)

Of course, but this was specifically in terminals where the colour closest to full white isn't.

>> The main problem is trusting "#ffffffffffff" to match a colour with the maximum range.
> 
> Why is that a problem, given the color representation we use in Emacs?

Because there is not always a matching (white) colour that has the maximum component value. The example I gave was for TERM=xterm-color, where the closest colour is (#xe5e5 #xe5e5 #xe5e5).

Note that this does not mean that the gamut for that terminal is somehow normalised with (0xe5e5 0xe5e5 0xe5e5) as perfect white; it is not. It is still the case that the maximum component value is either #xffff or #xff00; in this case #xffff.

Now, for non-TTY Emacs, we typically have an unlimited number of colours and (color-values "#ffffffffffff") returns the expected value. The same goes for a TTY where "white" is indeed white and not washed-out grey, such as TERM=linux.

> Sorry, you lost me here.  I don't understand what you are saying here
> and what does that have to do with the problem being discussed.

Let me try again:
(1) We know that the maximum colour component value is 65535 or 65280, depending on the platform (display system).
(2) color-name-to-rgb needs the maximum colour component value in order to normalise the result.
(3) color-name-to-rgb currently uses (color-values "#ffffffffffff") to obtain the maximum colour component value, but it is not always correct.
(4) Instead, we can just use 65535 or 65280 right away, which is fast and always correct.

The rest of my argument was merely discarding the possible alternative solution of redefining "white" as (255 255 255) for xterm-color.

> yields "(65535 65535 65535)", so I don't think I understand what
> problem you are concerned with here, and how can this cause a crash.

Sorry, I should have been more specific: this condition is present earlier, in frame-set-background-mode, before the --eval arguments are processed. This only pertains to the main part of the patch, which we have not yet discussed. I cannot fault you for being impatient!






  reply	other threads:[~2020-06-05 15:50 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 16:29 bug#41544: 26.3; Possible incorrect results from color-distance Simon Pugnet
2020-05-28 17:31 ` Mattias Engdegård
2020-05-29 15:17   ` Mattias Engdegård
2020-05-29 15:36     ` Eli Zaretskii
2020-05-29 17:28       ` Mattias Engdegård
2020-05-29 17:52     ` Tom Tromey
2020-05-31 20:46       ` Mattias Engdegård
2020-06-01 16:32         ` Eli Zaretskii
2020-06-01 17:24           ` Mattias Engdegård
2020-06-01 17:35             ` Eli Zaretskii
2020-06-01 17:44               ` Eli Zaretskii
2020-06-02 15:27                 ` Mattias Engdegård
2020-06-02 16:14                   ` Eli Zaretskii
2020-06-02 20:41                     ` Mattias Engdegård
2020-06-03 14:24                       ` Eli Zaretskii
2020-06-03 15:01                         ` Mattias Engdegård
2020-06-03 15:59                           ` Eli Zaretskii
2020-06-03 20:08                             ` Mattias Engdegård
2020-06-04 14:07                               ` Eli Zaretskii
2020-06-04 15:29                                 ` Mattias Engdegård
2020-06-05 12:27                                   ` Eli Zaretskii
2020-06-05 15:50                                     ` Mattias Engdegård [this message]
2020-06-06  7:29                                       ` Eli Zaretskii
2020-06-06 10:59                                         ` Mattias Engdegård
2020-06-06 11:59                                           ` Eli Zaretskii
2020-06-06 13:29                                             ` Mattias Engdegård
2020-06-06 13:57                                               ` Eli Zaretskii
2020-06-06 16:54                                                 ` Mattias Engdegård
2020-06-06 18:15                                                   ` Drew Adams
2020-06-07  9:13                                                     ` Mattias Engdegård
2020-06-07 14:30                                                       ` Eli Zaretskii
2020-06-07 16:12                                                         ` Drew Adams
2020-06-09 12:19                                                         ` Mattias Engdegård
2020-06-07 16:00                                                       ` Drew Adams
2020-06-06 18:27                                                   ` Eli Zaretskii
2020-06-07  9:04                                                     ` Simen Heggestøyl
     [not found]                                                     ` <87pnabfdr5.fsf@simenheg@gmail.com>
2020-06-07 10:14                                                       ` Mattias Engdegård
2020-06-07 19:23                                                         ` Simen Heggestøyl
     [not found]                                                         ` <87d06ar87d.fsf@simenheg@gmail.com>
2020-06-07 19:27                                                           ` Mattias Engdegård
2020-06-08 18:39                                                             ` Simen Heggestøyl
2020-06-07 14:26                                                       ` Eli Zaretskii
2020-06-07 16:10                                                         ` Drew Adams
2020-06-07 19:26                                                         ` Simen Heggestøyl
2020-06-08 13:11                                                     ` Mattias Engdegård
2020-06-08 14:30                                                       ` Drew Adams
2020-06-08 19:53                                                         ` Mattias Engdegård
2020-06-10 18:37                                                           ` Drew Adams
2020-06-10 19:12                                                             ` Mattias Engdegård
2020-06-09 16:20                                                       ` Eli Zaretskii
2020-06-10 14:51                                                         ` Mattias Engdegård
2020-06-10 15:08                                                           ` Eli Zaretskii
2020-06-10 18:29                                                             ` Mattias Engdegård
2020-06-10 18:45                                                               ` Eli Zaretskii
2020-08-18 13:44                                                                 ` Lars Ingebrigtsen
2020-08-18 14:06                                                                   ` Eli Zaretskii
2020-08-18 14:10                                                                     ` Lars Ingebrigtsen
2020-08-18 14:19                                                                       ` Mattias Engdegård
2020-08-19 10:11                                                                         ` Lars Ingebrigtsen
2020-08-19 11:28                                                                           ` Mattias Engdegård
2020-08-19 11:34                                                                             ` Lars Ingebrigtsen
2020-08-18 14:51                                                                       ` Eli Zaretskii
2020-08-19 10:13                                                                         ` Lars Ingebrigtsen
2020-08-19 14:52                                                                           ` Eli Zaretskii
2020-08-19 15:03                                                                             ` Lars Ingebrigtsen
2020-08-19 17:15                                                                               ` Eli Zaretskii
2020-08-20 13:08                                                                                 ` Lars Ingebrigtsen
2020-08-21 11:32                                                                                   ` Mattias Engdegård
2020-08-22 13:22                                                                                     ` Lars Ingebrigtsen
2020-06-04  6:15                       ` Simon Pugnet
2020-06-04  8:57                         ` Mattias Engdegård
2020-06-01 19:46         ` Basil L. Contovounesios
2020-06-02 15:08           ` Mattias Engdegård

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=3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@acm.org \
    --to=mattiase@acm.org \
    --cc=41544@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=simon@polaris64.net \
    --cc=tom@tromey.com \
    /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.