====== BASH - Colors - 3 and 4-bit Colors ====== 8 Colors. ---- ===== Format ===== ESC[ 0;⟨n⟩ m Select normal color ESC[ 1;⟨n⟩ m Select bright color where n is: * **30** is BLACK. * **31** is RED. * **32** is GREEN. * **33** is YELLOW. * **34** is BLUE. * **35** is MAGENTA. * **36** is CYAN. * **37** is WHITE. * **90** is BRIGHT BLACK (GRAY). * **91** is BRIGHT RED. * **92** is BRIGHT GREEN. * **93** is BRIGHT YELLOW. * **94** is BRIGHT BLUE. * **95** is BRIGHT MAGENTA. * **96** is BRIGHT CYAN. * **37** is BRIGHT WHITE. ---- ===== Red Example ===== echo -e "\033[0;31mThis is in RED" **NOTE:** This is made up of: * **\033** - Represents the ESC key. * **[0;** - Normal color. * **[31m]** - Red; from color table. ---- ===== Bright Red Example ===== echo -e "\033[1;31mThis is in BRIGHT RED" ---- **NOTE:** This is made up of: * **\033** - Represents the ESC key. * **[1;** - Bright color. * **[31m]** - Red; from color table. Notice this is NOT using the bright numbers from the color table. Bright colors can be used simply by using a **1** after the ESC instead of a **0**. * Some older systems may not support this, so in this case use the alternative number from the color table; echo -e "\033[0;91mThis is in BRIGHT RED" * Here the **31m** has been changed to **91m**. ---- ===== Red Blue ===== echo -e "\033[0;31mThis is in RED\033[0;34mThis is in Blue" ---- ===== ANSI Rainbow ===== for (( i = 30; i < 38; i++ )); do echo -e "\033[0;"$i"m Normal: (0;$i); \033[1;"$i"m Bright: (1;$i)"; done ----