Now, most of command line platforms have got True Color support. iTerm3, Tmux, (Neo)Vim, and literally every tool I use for my daily works, except for Emacs.
Fortunately, there's unofficial patch for Emacs to support True Color. Today I succeeded in making it work, and would like to share it briefly.
Preparation
1. The source code of Emacs 24.5
We should apply a patch to the Emacs source code and build it manually. You can easily find the code online. I personally used the GitHub mirror. FYI, downloading an archive is a way faster than cloning the whole repo.
The newest version of Emacs is actually 25, but I failed to find a patch for Emacs 25.
2. The True Color patch
It's just a diff file which enables True Color in Emacs.
- Gist: The gist is forked from the original patch.
- Raw Diff
How to do
First, prepare the code and the patch above.
unzip emacs-emacs-24.5.zip
cd emacs-emacs-24.5
wget https:/ ... /emacs-24.5-24bit.diff
Second, apply the patch. You can do it with the patch
command or git apply
if you're in a git repo(recommended).
git apply emacs-24.5-24bit.diff
Now build the source code.
./autogen.sh
./configure
make
Some build errors may or may not occur, but they must be easily resolved with some Googling :)
Now, the built binary will be placed in src/emacs
. Just copy it to $PATH
and
that's it.
The True Color support is not enabled by default. Please set a command line
argument --color=true-color
, or set an environment variable EMACS_TRUE_COLOR_SEPARATOR
as :
or ;
.
emacs --color=true-color
# or
export EMACS_TRUE_COLOR_SEPARATOR=';'
emacs
That's it. Happy Emacs!