I don’t like to remember things so here comes a short list of Ansi color codes that can be used in your bash:

# ANSI color codes
RS="[33[0m]" # reset
HC="[33[1m]" # hicolor
UL="[33[4m]" # underline
INV="[33[7m]" # inverse background and foreground
FBLK="[33[30m]" # foreground black
FRED="[33[31m]" # foreground red
FGRN="[33[32m]" # foreground green
FYEL="[33[33m]" # foreground yellow
FBLE="[33[34m]" # foreground blue
FMAG="[33[35m]" # foreground magenta
FCYN="[33[36m]" # foreground cyan
FWHT="[33[37m]" # foreground white
BBLK="[33[40m]" # background black
BRED="[33[41m]" # background red
BGRN="[33[42m]" # background green
BYEL="[33[43m]" # background yellow
BBLE="[33[44m]" # background blue
BMAG="[33[45m]" # background magenta
BCYN="[33[46m]" # background cyan
BWHT="[33[47m]" # background white

# and using these codes we can define e.g. 'cleaner' PS1
PS1="$HC$FBLE[ $FGRN${debian_chroot:+($debian_chroot)}u$FGRN: $FYELw $FBLE]\$ $RS"

So, basically, instead of writing these codes in form of [33[47m] or something like that, we write BWHT instead. cleaner and less frustrating 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.