Console output coloring
10 April 2023,
by Goodman.
Last update at 14 March 2026
Colour
Black 0;30 Dark Gray 1;30
Red 0;31 Light Red 1;31
Green 0;32 Light Green 1;32
Brown/Orange 0;33 Yellow 1;33
Blue 0;34 Light Blue 1;34
Purple 0;35 Light Purple 1;35
Cyan 0;36 Light Cyan 1;36
Light Gray 0;37 White 1;37
echo -e "\e[<style>;<color>mYour text here\e[0m"
- \e[ - start escape sequence
- <style> text style (bold, underline, etc.)
- <color> - foreground color
- m - apply formatting
- \e[0m - reset formatting
Bold Text
| Code |
Style |
| 0 |
Reset |
| 1 |
Bold |
| 2 |
Dim |
| 3 |
Italic |
| 4 |
Underline |
| 5 |
Blink |
| 7 |
Reverse |
Foreground Colors
| Color |
Code |
| Black |
30 |
| Red |
31 |
| Green |
32 |
| Yellow |
33 |
| Blue |
34 |
| Magenta |
35 |
| Cyan |
36 |
| White |
37 |
Background Colors
| Color |
Code |
| Black |
40 |
| Red |
41 |
| Green |
42 |
| Yellow |
43 |
| Blue |
44 |
| Magenta |
45 |
| Cyan |
46 |
| White |
47 |
RED='\033[0;31m'
NC='\033[0m' # No Color
printf "I ${RED}Red message${NC} \n"
echo -e "\e[1;31mBold red error\e[0m"
echo -e "\e[1;32mBold green text\e[0m"
echo -e "\e[1;37;41mBold white on red\e[0m"
NC='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[0;37m'
RED="\e[31m"
GREEN="\e[32m"
BOLD="\e[1m"
RESET="\e[0m"
echo -e "${BOLD}${GREEN}Success${RESET}"
echo -e "${BOLD}${RED}Error${RESET}"