Shell Script

bash color

1. Intro

Bash script color table

 

2. Command

2.1. Set

# Set
echo -e "### Set"
echo -e "\e[1mBold \e[0m"
echo -e "\e[2mDim \e[0m"
echo -e "\e[4mUnderlined \e[0m"
echo -e "\e[5mBlink \e[0m"
echo -e "\e[7minverted \e[0m"
echo -e "\e[8mHidden \e[0m"

 

2.2. Reset

# Reset
echo -e "\n### Reset"
echo -e "\e[0mAll reset"
echo -e "\e[1mBold \e[21m Bold \e[0m"
echo -e "\e[2mDim \e[22m Dim \e[0m"
echo -e "\e[4mUnderlined \e[24m Underlined \e[0m"
echo -e "\e[5mBlink \e[25m Blink \e[0m"
echo -e "\e[7minverted \e[27m inverted \e[0m"
echo -e "\e[8mHidden \e[28m Hidden \e[0m"

 

2.3. Foreground (text)

# Foreground (text)
echo -e "\n### Foreground (text)"
echo -e "\e[39mDefault \e[0m"
echo -e "\e[30mBlack \e[0m"
echo -e "\e[31mRed \e[0m"
echo -e "\e[32mGreen \e[0m"
echo -e "\e[33mYellow \e[0m"
echo -e "\e[34mBlue \e[0m"
echo -e "\e[35mMagenta \e[0m"
echo -e "\e[36mCyan \e[0m"
echo -e "\e[37mLight gray \e[0m"
echo -e "\e[90mDark gray \e[0m"
echo -e "\e[91mLight red \e[0m"
echo -e "\e[92mLight green \e[0m"
echo -e "\e[93mLight yellow \e[0m"
echo -e "\e[94mLight blue \e[0m"
echo -e "\e[95mLight magenta \e[0m"
echo -e "\e[96mLight cyan \e[0m"
echo -e "\e[97mWhite \e[0m"

 

2.4. Background

# Background
echo -e "\n### Background"
echo -e "\e[49mDefault \e[0m"
echo -e "\e[40mBlack \e[0m"
echo -e "\e[41mRed \e[0m"
echo -e "\e[42mGreen \e[0m"
echo -e "\e[43mYellow \e[0m"
echo -e "\e[44mBlue \e[0m"
echo -e "\e[45mMagenta \e[0m"
echo -e "\e[46mCyan \e[0m"
echo -e "\e[47mLight gray \e[0m"
echo -e "\e[100mDark gray \e[0m"
echo -e "\e[101mLight red \e[0m"
echo -e "\e[102mLight green \e[0m"
echo -e "\e[103mLight yellow \e[0m"
echo -e "\e[104mLight blue \e[0m"
echo -e "\e[105mLight magenta \e[0m"
echo -e "\e[106mLight cyan \e[0m"
echo -e "\e[107mWhite \e[0m"

 

Back To Top