ANSI escape codes add color and style to terminal output. The format is ESC[ + code + m (the ESC byte is \033 or \e). For example \e[31m turns text red and \e[0m resets it.
| SGR code | Effect |
|---|---|
| 0 | Reset all |
| 1 | Bold |
| 2 | Dim |
| 3 | Italic |
| 4 | Underline |
| 7 | Reverse |
| 30 | Black text |
| 31 | Red text |
| 32 | Green text |
| 33 | Yellow text |
| 34 | Blue text |
| 35 | Magenta text |
| 36 | Cyan text |
| 37 | White text |
| 90 | Bright black (gray) |
| 91 | Bright red |
| 40 | Black background |
| 41 | Red background |
| 42 | Green background |
| 44 | Blue background |
| 47 | White background |
Example
echo -e "\e[1;32mSuccess\e[0m" prints Success in bold green.