Retaining bash prompt colors when starting a screen session
You can edit the following line in your .bashrc (it's #39 in my .bashrc):
#force_color_prompt=yes
Change to:
force_color_prompt=yes
This could possibly be annoying if you log in from somewhere where color is not supported, but i find it highly unlikely.
The .screenrc
file is a mystery to me. Mine is gobbledygook that I copypasta'd from the internets. However, I see a few lines that look to be relevant to your problem:
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
I think if you add the above lines to yours, you'll get colour. Here's my whole .screenrc
for reference:
jake@daedalus:~$ cat .screenrc
startup_message off # skip splash screen
vbell off # Kill the annoying dog
# Voodoo
hardstatus alwayslastline
hardstatus string '%{= wk}%-Lw%{= KW}%50>%n%f* %t%{= dK}%+Lw%<'
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"
Screen normally uses a special terminal type, such as "screen", or if you set it in your .screenrc, "screen-256color".
Just look in your .bashrc for the color detection case statement and add screen to the list.
For example, something like this:
case "$TERM" in
xterm)
color_prompt=yes
;;
screen)
color_prompt=yes
;;
*256*)
color_prompt=yes
;;
esac
I use 256-color terminal types, so I just need the 256 case statement, since it catches xterm-256color, gnome-256color, and screen-256color. Your mileage may vary.