Color your Bash Prompt, 16M edition!

#OPTIONS: toc:nil

Menu

How to color the Bash prompt

I have revised the script to color my bash prompt, which now manages colors expressed as R;G;B, in terminals which support 16M colors.

To make it short (after all, you need some time to try all 16M colors, don’t you?):

and here you can find the script here: color-bash-prompt-16M.

Some examples:

$ cat bash_prompt.sh # so that you know what it does

$ source bash_prompt.sh

$ list_colors
...

$ set_prompt_color --256 255

# quotes are important since ; separates commands
$ set_prompt_color --16M "255;120;120"

You can use a third argument to set the background color as well.