How to apply a Emacs custom color theme in console mode

colorsconsoleemacs

When I load a custom color scheme (through M-x load-theme or M-x customize-theme) the results only seem to be applied when Emacs runs in a separate window:

Emacs in GUI

But when Emacs is run in a terminal with -nw, the default colors seem to be used:

Emacs in terminal
(source: raghav at www.ocf.berkeley.edu)

I'm new to Emacs, so I don't know if this is expected behavior — but it doesn't seem to be, since Googling turns up several people discussing using color themes in console mode. Any help would be much appreciated.

Best Solution

I am very late, but I had the same problem and I solved it adding the following line to my ~/.zshrc

export TERM=xterm-256color

If you are not using zsh (for example you are using bash), you must add it on your right console init file (for example ~/.bashrc)

Related Question