emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list-colors-display: display all color names


From: Juri Linkov
Subject: Re: list-colors-display: display all color names
Date: Wed, 05 Jan 2005 07:32:52 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

"Eli Zaretskii" <address@hidden> writes:
>> From: Juri Linkov <address@hidden>
>> it might be difficult for users to obtain corresponding hex values.
>
> How about adding a function color-values-hex, which calls color-values
> and then transforms the result into the hex #RGB notation?  Would that
> fix this problem?

A function is not a problem.  A simple piece of code like this

         (apply 'format " #%02x%02x%02x"
                 (mapcar (lambda (c) (lsh c -8)) (color-values color)))

can do that.  Creating a special function with this code will not
fix this problem since users might not be aware of such a function.
Adding #RGB to every color name displayed by `list-colors-display'
in the *Colors* buffer is a more practical solution.

>> Also, users might want to find the color name corresponding to
>> the known RGB value.
>
> For more-or-less standard RGB values, the ones listed in
> tty-colors.el, doing that is simply a matter of searching the alist
> returned by tty-color-alist; if trhat is what you want, does this
> justify a new feature?

RGB values returned by tty-color-alist are represented as integers
0-65535 while the most widespread format for specifying color triplets
is hexadecimal #RRGGBB.

>> gray                    grey                                   bebebe
>> light gray              light grey, LightGray, LightGrey       d3d3d3
>
> First, if we do that, I'd suggest to use #BE12BE34BE56, i.e. prefix
> with # and use 4 digits per color.

4 digits per color?  Why?  The human eye can distinguish no more than about
400,000 colors (some say 10 million colors which is the largest estimation)
and can identify far less colors.  8 bits per color which encodes more
than 16 million colors is completely enough (usually even 600 colors
displayed by `list-colors-display' is enough).  I won't argue about why
Emacs supports so many colors (10^14), but what I want to say is that using
any format longer than #RRGGBB is too impractical.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]