14

My understanding is that ansi-term only supports 8 colors (a good discussion of this in reddit here).

Meanwhile, an increasing number of terminal emulators (e.g. tmux or iTerm2 in OS X) support True color (24 bit, i.e. 16 million colors). A good list can be found here.

  • If the 8-color cap is specific to ansi-term, are there any other packages for terminal emulation that are trying to address this limitation?
  • Are there any plans to bring True color support to a terminal emulator in Emacs?

And maybe to confirm:

  • Is there any way to effectively have more than 8 colors in ansi-term buffers?
  • Is tweaking ansi-color-names-vector still the recommended way of setting ansi-term colors in Emacs 25?

How to test if an emulator supports "True color":

Here is a snippet from the link above that would test if the emulator supports True colors:

awk 'BEGIN{
    s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
    for (colnum = 0; colnum<77; colnum++) {
        r = 255-(colnum*255/76);
        g = (colnum*510/76);
        b = (colnum*255/76);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum+1,1);
    }
    printf "\n";
}'

If it is supported, the bottom line would display a nice gradient like the one shown below:

enter image description here


From what I read, NeoVim (a VIM editor) added support for it in 2015, and there was a request made to Emacs bugs to add it.

  • As of Emacs 26, I cannot see ansi-color-names-vector as a variable I can customize. Besides that, I run multi-term and with zsh as shell. Your script does not produce a positive output :-( – spav Feb 7 '17 at 7:33
2

It is correct that ansi-term only supports 8 colors, but, using xterm-color.el instead of ansi-color.el, you get 256 colors.

"ANSI & xterm-256 color text property translator for Emacs"

https://github.com/atomontage/xterm-color

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.