Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting 256 Colors in Emacs *shell*

Tags:

emacs

My Emacs installation has full color support (list-colors-display shows this). However, Emacs *shell* only appears to be able to handle the basic 8 ANSI color escapes. I have those handled by the following in my .emacs:

(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

Is there a way to increase the number of colors supported in *shell*?

like image 487
Derek Thurn Avatar asked Jul 19 '11 00:07

Derek Thurn


2 Answers

To get 256-color in terminal you must use appropriate terminal emulator.

Check if your terminal suport this:

  $ infocmp -1 $TERM | grep colors
colors#8,

For example xterm allow this, but you must set TERM=xterm-256color.

like image 65
gavenkoa Avatar answered Oct 01 '22 11:10

gavenkoa


If I'm reading correctly setting ansi flags/settings will only allow 8 colors,get rid of them and replace with this setting tty-color-mode 256

From:

http://www.gnu.org/software/emacs/elisp/html_node/Font-and-Color-Parameters.html

http://www.gnu.org/software/libtool/manual/emacs/Colors.html

like image 33
gmlime Avatar answered Oct 01 '22 11:10

gmlime