tmux not colorizing PS1 prompt

My solution to this problem was setting

force_color_prompt=yes

in my .bashrc. Now my tmux prompt has color.


On my machine the solution is to add

set -g default-terminal "xterm-256color"

to ~/.tmux.conf.


Your PS1 also gives me black and white output.

However switching back to mine gives me color, so you should be able to figure out the different, I use

$ echo $PS1
\[\033[01;31m\]\t \[\033[01;32m\]durrantm \[\033[02;36m\]\h \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"` \[\033[00;33m\]$(git_branch)\[\033[00m\]\n\$

git_branch is a bash function I have which is:

git_branch () { 
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}

Yours vs. Mine:

enter image description here

This works the same on OSX and Ubuntu