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

Heime <[email protected]> Sun, 19 Jul 2026 11:57:33 +0000
Newsgroups gmane.emacs.help
Message-ID <k7517ntyZkaptPSMHWQjczQj_naVoZAPujIHikEIp_RsHueWjQnNrL3ORtdBlKyZ5Aoo0T4IzVJG_AYdvBuUPvIt5tBJeHAtdFW5PnKJkSs=@protonmail.com>
On Sunday, July 19th, 2026 at 11:32 PM, Eli Zaretskii <[email protected]> wrote:

> > Date: Sun, 19 Jul 2026 11:27:13 +0000
> > From: Heime <[email protected]>
> > Cc: [email protected], [email protected], [email protected]
> >
> > On Sunday, July 19th, 2026 at 4:27 PM, Eli Zaretskii <[email protected]> wro=
te:
> >
> > > > I have a difficulty.  How can I define a face that would be support=
ed
> > > > by Emacs on some terminal?
> > >
> > > Any color definition of a face will always be supported on all
> > > terminals.  You don't need to worry about that, as Emacs solves the
> > > problem automatically, by choosing the closest color supported by the
> > > terminal.
> >
> > Would you suggest for me to define a face using a colour name from
> > list-colors-display on an Emacs GUI frame?
>=20
> Yes.
>=20
> > What does one do when the name is not in the list returned by
> > defined-colors.
>=20
> Emacs will automatically find the best approximation.
>=20
> > You were correct in the statement that using colours is complicated.
> > Initially, I had the plan to define actual colours for each terminal
> > capability, detect which to use and apply accordingly during the Emacs
> > initialisation phase.
>=20
> That is a significant complication that is entirely unnecessary.  The
> automatic color approximation was added to Emacs precisely for this
> purpose: so that defface specifications will not have endless
> terminal-dependent parts.  More importantly, it was so a face doesn't
> fail to display because someone forgot to mention some terminal type.
=20
Right.   It got me to the same thing - endless terminal-dependent parts
and the capability of failure for some terminal types.  And this for just
one colour definition.