rainbow-bash-prompt makes your bash prompt rainbow by using dosentmatter/lolcat.
If you are looking for a rainbow prompt for zsh, check out dosentmatter/rainbow-zsh-prompt
Tested on macOS Sierra (Terminal and iTerm2) and Ubuntu (GNOME Terminal)
- bash must be compiled with readline.
- Install C implementation of dosentmatter/lolcat for speed.
- That is a fork of jaseg/lolcat with a minor change to make the colors pseudo random.
- Put the binary in your
$PATH
and name itlolcat-c
- copy
.bash_prompt
to your$HOME
directory - Add this to your
.bashrc
:
if [[ -f ~/.bash_prompt ]]; then
. ~/.bash_prompt
fi
- You can turn on and off debugging by setting
PS1_DEBUG
to'true'
or'false'
. Debugging is used to show the non-printing characters and highlight them. It has a line wrap issue as shown in the asciinema recording above that seems to be caused by colored prompts that are too long. This is not an issue because it is only meant for debugging. - You can change the command used to colorize
PS1
by settingPS1_COLORIZE_COMMAND
to a name of a function.- Currently, it is set to
'__ps1_lolcat'
which useslolcat-c
for speed. - If you have rbenv with ruby busyloop/lolcat or pyenv with python tehmaze/lolcat installed, you can set
PS1_COLORIZE_COMMAND
to'__ps1_lolcat_ruby'
or'__ps1_lolcat_python'
- Currently, it is set to
- You can change the command used to format the debug output by setting
PS1_DEBUG_COMMAND
to a name of a function.- Currently, it is set to
__ps1_debug
which displays non-printing characters and colors them.
- Currently, it is set to
To have double quotes "
and backslashes \
work in both regular and debug mode, PS1 has to have \\"
and \\\\
respectively to have the right number of escapes for both modes.