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

uzibalqa <[email protected]> Fri, 17 Jul 2026 13:22:13 +0000
Newsgroups gmane.emacs.help
Message-ID <J2T_4eCy3Ao3fAtcKN7lLnEWTSUwct1AtXzvWlnqC2nqWW_JeP_zwLqlFbj7-zAfQpFywoNTRLtig6OFRK_cTOIxb3tfYaFEaXXVv6MVm4U=@proton.me>
On Saturday, July 18th, 2026 at 12:45 AM, Eli Zaretskii <[email protected]> wrot=
e:

> > Date: Fri, 17 Jul 2026 12:10:15 +0000
> > From: Heime <[email protected]>
> > Cc: [email protected], [email protected]
> >
> > On Friday, July 17th, 2026 at 11:21 PM, Eli Zaretskii <[email protected]> wr=
ote:
> >
> > > Understanding why we do in Emacs's sources what we do there requires =
a
> > > lot of knowledge about the internal workings and the history of Emacs=
.
> > > All of that is completely irrelevant to writing code on the level on
> > > which you are now.  So please take the advice you are given and try
> > > it, and only ask followup questions about "other ways of doing that"
> > > if the advice doesn't work for some reason.
> > >
> > > Okay?
> >
> > What is the advice exactly?
>=20
> The advice it to always use 4-hex digit specifications for the RGB
> components, if you don't want to use color names.

Right, so I use #RRRRGGGGBBBB to compute my contrast ratios.
=20
> > Which value should one use, the common #RRGGBB or the #RRRRGGGGBBBB.
>=20
> For your cases, the latter, always the latter.

So will use the latter #RRRRGGGGBBBB
=20
> > For instance modus-themes uses #RRGGBB.
>=20
> Leave that to the developers of modus-themes.

Leaving developers using #RRGGBB contrary to advice.  Or perhaps using
#RRGGBB and giving them names is ok.
=20
> > Emacs internally uses 16-bit per component, but the displayed hex code
> > is usually 6-digit.  Can't people see a problem with this!
>=20
> There is no problem.  You are just imagining a problem.
=20
I cannot see how I am imagining it.  The advice is to always use 4-hex digi=
t specifications for the RGB components as #RRRRGGGGBBBB.  Furthermore, for=
 my=20
cases I always have to use the latter #RRRRGGGGBBBB.

If the advice is always to use #RRRRGGGGBBBB, which is also always the advi=
ce
for my cases,  then how (list-colors-display) showing me #RRGGBB follows th=
e=20
advice you described?  To follow your advice, display #RRRRGGGGBBBB, not
the currently displayed #RRGGBB.