Re: Retrieving color names and hex values using list-colors-display for coding purposes

Eli Zaretskii <[email protected]> Fri, 17 Jul 2026 17:34:12 +0300
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
> Date: Fri, 17 Jul 2026 14:28:11 +0000
> From: Heime <[email protected]>
> Cc: uzibalqa <[email protected]>, [email protected], [email protected]
> 
> 
> 
> 
> 
> Sent with Proton Mail secure email.
> 
> On Saturday, July 18th, 2026 at 1:33 AM, Eli Zaretskii <[email protected]> wrote:
> 
> > > Date: Fri, 17 Jul 2026 13:22:13 +0000
> > > From: uzibalqa <[email protected]>
> > > Cc: Heime <[email protected]>, [email protected], [email protected]
> > >
> > > If the advice is always to use #RRRRGGGGBBBB, which is also always the advice
> > > for my cases,  then how (list-colors-display) showing me #RRGGBB follows the
> > > advice you described?  To follow your advice, display #RRRRGGGGBBBB, not
> > > the currently displayed #RRGGBB.
> > 
> > Are you writing list-colors-display?  If not, why is it important that
> > it shows 6-digit RGB values?
> 
> Because colour-values on the name are in range 0-65535, a range that 
> definitly requires hex RRRR and not hex RR.  The hex value is unique,
> consequently using  RR instead of RRRR is incorrect.
> 
> Multiple (0-65535) values map to the same #RR value, breaking uniqueness 
> and accuracy.  Colour accuracy matters for contrast calculations, accessibility, 
> and precise colour matching.  The emphasis on the importance of 6-digit 
> hex values is that they uniquely and accurately represent the colour in 
> the standard hex format.

All of the above are reasons to use 16-bit values for each RGB
component.  That way, you don't lose accuracy when specifying a color.