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

From: Mattias Engdegård <[email-masked]>
Date: Fri, 29 May 2020 19:28:44 +0200

29 maj 2020 kl. 17.36 skrev Eli Zaretskii <[email-masked]>:

> Did you try what this does to tty-color-approximate and friends,
> especially when the terminal supports only 8 or 16 colors?  If not,
> please do, we must ensure there are no regressions there.

tty-color-approximate uses its own metric (square of the unweighted Euclidian RGB distance).
To test the TTY_SAME_COLOR_THRESHOLD, I tried display-supports-face-attributes-p, and it seems to behave in the same way. All tested with TERM=xterm-color, which gives the standard 8 colours.

The translated constants were obtained by generating many random RGB triples and computing distances between all pairs, then finding the value of NEWCONST which minimises the number of cases where

  old-colour-dist(c1,c2) < OLDCONST

and

  new-colour-dist(c1,c2) < NEWCONST

differ in truth value. The computation was also run on the rgb.txt list instead of random colours as an extra check.