Skip to content

Conversation

@tazjin
Copy link

@tazjin tazjin commented Jul 4, 2025

This commit adds the default theme used in Emacs' terminal emulator modes (such as ansi-term) when running GUI Emacs without any configuration.

The colour palette of this theme traces back through a long lineage, starting with the original rgb.txt distributed with X11 after its development at MIT. The exact names of who picked which colours here are unknown (people didn't spend as much time on version control 41 years ago), so I have attributed it to Jim Gettys (original X11 developer) & co.

In Emacs source code, the colurs can be found in lisp/term/tty-colors.el, and are mapped to ANSI colours from there in lisp/ansi-color.el.

I had to convert them from 16-bit colour space to the 8-bit colour space used by Alacritty (ironic, considering the relative age of the programs!).

This was done using some Lisp and Python code which mapped the 16-bit RGB to LAB colour space, and back to 8-bit RGB. I experimented with multiple ways of doing this, and simple rounding or bit-shifting yielded visually unpleasing results, whereas the LAB-match is pretty accurate.

This commit adds the default theme used in Emacs' terminal emulator
modes (such as `ansi-term`) when running GUI Emacs without any
configuration.

The colour palette of this theme traces back through a long lineage,
starting with the original `rgb.txt` distributed with X11 after its
development at MIT. The exact names of who picked which colours here are
unknown (people didn't spend as much time on version control 41 years
ago), so I have attributed it to Jim Gettys (original X11 developer) &
co.

In Emacs source code, the colurs can be found in
`lisp/term/tty-colors.el`, and are mapped to ANSI colours from there in
`lisp/ansi-color.el`.

I had to convert them from 16-bit colour space to the 8-bit colour space
used by Alacritty (ironic, considering the relative age of the
programs!).

This was done using some Lisp and Python code which mapped the 16-bit
RGB to LAB colour space, and back to 8-bit RGB. I experimented with
multiple ways of doing this, and simple rounding or bit-shifting yielded
visually unpleasing results, whereas the LAB-match is pretty accurate.
@tazjin
Copy link
Author

tazjin commented Jul 4, 2025

For comparison (didn't want to put this in the commit message itself), here is a screenshot of the theme in actual Emacs, using the 16-bit colour space:

emacs

Versus the Alacritty version:

alacritty

As you can see, the conversion worked pretty well.

@chrisduerr
Copy link
Member

As you can see, the conversion worked pretty well.

But it didn't… Those are clearly different colors, trivially verified by just looking at the images. I'm confused why you went through so much trouble when you can just get the rgb color codes from the images directly. Yellow for example is #cdcd00 in Emacs while being #c0c000 in your theme.

Copy link
Member

@chrisduerr chrisduerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These colors do not match your desired result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants