Subject: bug#41544: 26.3; Possible incorrect results from color-distance

From: Mattias Engdegård <[email-masked]>
Date: Tue, 2 Jun 2020 17:27:46 +0200

1 juni 2020 kl. 19.44 skrev Eli Zaretskii <[email-masked]>:

>> I'm just looking at the changes.  I see a change in how colors are
>> converted to RGB triplets.  I see a change in what colors are
>> considered dark and light, with a new function which decides that that
>> is being used for frame background mode and in several lisp/term/
>> files, including 16-color terminals.  I'm asking why do we want to
>> make all those changes, which modify very basic aspects of our color
>> support on many terminals.
> 
> And then, of course, there are the changes in color-distance itself,
> which change the values it returns.  Again, why such significant
> changes to fix an otherwise insignificant bug?

It is difficult to give precise answers to vague complaints. Take one thing at a time: as I wrote, there are two different patches addressing two almost completely different issues. Let's start with the color-distance changes, out of respect for the bug reporter if nothing else.

It is not possible to change a function without changing it. Either we fix it or we don't. The reported bug was about broken symmetry, which is rather embarrassing; as written previously, the first analysis uncovered deeper issues worth fixing, such as loss of precision and (especially) the nonlinearity that causes triangle inequality violation.

The proposed fixes to color-distance, I hope you agree, are straightforward, reasonable and address all these points. Callers have been updated with carefully recomputed comparison constants; I detailed how they were obtained in a previous reply, and test have all been satisfactory.