emacs' true colors

2020-03-26

This is another feature I was really looking forward to about three years ago, and now setting it up went very smoothly: make use of 24bit colors when running Emacs in a terminal emulator. That means you can make use of a lot more colors than the typical 16 or 256. It was pretty tiresome to sync color names and setup between e.g. the Emacs color-theme you're trying to set up and the scheme you had set for the terminal emulator. Being able to render 16 million colors means that faces and themes that are usually set up for GUI Emacs, work smoothly in the terminal as well.

In my case that emulator is iTerm2, but many major terminal emulators now support 24bit colors. @XVilka lists a couple of checks you can run to check your emulator (version), this is the quick one I used:

printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"

Which prints TRUECOLOR in orange in iTerm2, in plain black/white in Terminal.app. Setup was straight-forward, I followed the spacemacs wiki.

My final check was to evaluate the following:

(display-color-cells) ; expecting 16777216

Happy coloring 😁