Tmux not displaying bash prompt colors

Tmux not displaying bash prompt colors

Here is a screenshot of my terminal when I open tmux:

tmux PS1 prompt before

Note: Here, my shell displays my [email protected] but it does not display it in colors  🙁

To make tmux read your bash colors, edit your tmux configuration file:

vim ~/.tmux.conf

Add the following line to the tmux config file:

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

Exit and save the file. Close and re-open tmux.

Now, when you open tmux you should be able to get your regular bash prompt colors. Here is a screenshot after re-opening tmux:


tmux $PS1 bash prompt color after modying tmux.conf

Hope this helps! Cheers!


Source: Link