Subject: Re: bug#6332: Colors lost from list-colors-display

From: Chong Yidong <[email-masked]>
Date: Fri, 04 Jun 2010 12:07:34 -0400

Juri Linkov <[email-masked]> writes:

> The comment added 2008-05-10 (revno#87519) says that the ordering of the
> colors is chosen for the user's convenience in `list-colors-display'.
>
> But later at 2009-08-05 I provided a patch that adds a new option
> `list-colors-sort' that defines the sorting order for `list-colors-display':
> http://thread.gmane.org/gmane.emacs.devel/113422/focus=113687
>
> I propose to revert 2008-05-10 change, so `x-colors' will be again the
> complete copy of etc/rgb.txt.  And to install my patch that implements the
> current sorting order in `x-colors' as the default value of the new option
> `list-colors-sort'.

Please don't revert the 2008-05-10 change.  The current order is quite
deliberate, as the comment in common-win.el makes clear:

  ;; The ordering of the colors is chosen for the user's convenience in
  ;; `list-colors-display', which displays the reverse of this list.
  ;; Roughly speaking, `list-colors-display' orders by (i) named shades
  ;; of grey with hue 0.0, sorted by value (ii) named colors with
  ;; saturation 1.0, sorted by hue, (iii) named non-white colors with
  ;; saturation less than 1.0, sorted by hue, (iv) other named shades of
  ;; white, (v) numbered colors sorted by hue, and (vi) numbered shades
  ;; of grey.

I have experimented with pure HSV ordering, and the results were
unsatisfactory, as it breaks apart groups of clearly-related color names
(e.g. purple[1-4]).  I don't object to adding an option that controls
how the colors are sorted.  However, the default must be a
human-specified ordering, since there is never any satisfactory way to
map a multi-dimensional space into one dimension.

It should be noted that while only the colors listed in `x-colors' are
displayed by list-colors-display, Emacs recognizes any color in rgb.txt.
So even if "dark green" is not in x-colors, setting a face color to
"dark green" still works.  Some of the colors in rgb.txt have duplicate
names, and I think are rightly omitted from x-colors.  For instance,
there is no need for us to list "grey99" and "gray99" separately.

Dark green itself, however, was inadvertently omitted.  I will add it
back (along with some other ommitted colors).