Using GNU Screen with 256 colors
I recently installed GNU screen on a machine I ssh into. How do I get GNU screen to use 256 colors?
So far, I've tried adding the following to my .screenrc
:
term screen-256color
and
attrcolor b ".I" # allow bold colors - necessary for some reason
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # tell screen how to set colors. AB = background, AF=foreground
defbce on # use current bg color for erased chars
but neither worked.
In the login shell, before I start screen, when I run this script, which prints 256 colors, I get normal output. When I use the command tput colors
I get the output 8
.
When I start screen and run the script, I get 16 colors mapped to 256 colors - there are large blocks of solid color. When I run tput colors
I get 256
(when term screen-256color
is in my .screenrc).
edit: I got it to work - I didn't configure screen with the --enable-colors256
option.
I personally put it in ~/.bashrc
export TERM=xterm-256color
If that does not work, what terminal are you using ?
If you built screen from source you'll need to recompile it with the 256 color flag enabled. Run ./configure --enable-colors256 && make && sudo make install