Terminal Color Codes Cheatsheet
Quick reference for terminal ANSI escape codes: text colors, background colors, formatting, and cursor control.
| Feature | Description | Example | Category |
|---|---|---|---|
| Black Text | Black foreground color | echo "\033[30mBlack Text\033[0m" | Text Colors |
| Red Text | Red foreground color | echo "\033[31mRed Text\033[0m" | Text Colors |
| Green Text | Green foreground color | echo "\033[32mGreen Text\033[0m" | Text Colors |
| Yellow Text | Yellow foreground color | echo "\033[33mYellow Text\033[0m" | Text Colors |
| Blue Text | Blue foreground color | echo "\033[34mBlue Text\033[0m" | Text Colors |
| Magenta Text | Magenta foreground color | echo "\033[35mMagenta Text\033[0m" | Text Colors |
| Cyan Text | Cyan foreground color | echo "\033[36mCyan Text\033[0m" | Text Colors |
| White Text | White foreground color | echo "\033[37mWhite Text\033[0m" | Text Colors |
| Black Background | Black background color | echo "\033[40mBlack BG\033[0m" | Background Colors |
| Red Background | Red background color | echo "\033[41mRed BG\033[0m" | Background Colors |
| Green Background | Green background color | echo "\033[42mGreen BG\033[0m" | Background Colors |
| Yellow Background | Yellow background color | echo "\033[43mYellow BG\033[0m" | Background Colors |
| Blue Background | Blue background color | echo "\033[44mBlue BG\033[0m" | Background Colors |
| Magenta Background | Magenta background color | echo "\033[45mMagenta BG\033[0m" | Background Colors |
| Cyan Background | Cyan background color | echo "\033[46mCyan BG\033[0m" | Background Colors |
| White Background | White background color | echo "\033[47mWhite BG\033[0m" | Background Colors |
| Bold | Bold/bright text | echo "\033[1mBold Text\033[0m" | Formatting |
| Dim | Dim/faint text | echo "\033[2mDim Text\033[0m" | Formatting |
| Italic | Italic text (not widely supported) | echo "\033[3mItalic Text\033[0m" | Formatting |
| Underline | Underlined text | echo "\033[4mUnderlined Text\033[0m" | Formatting |
| Blink | Blinking text | echo "\033[5mBlinking Text\033[0m" | Formatting |
| Reverse | Reverse video (invert colors) | echo "\033[7mReverse Text\033[0m" | Formatting |
| Hidden | Hidden/concealed text | echo "\033[8mHidden Text\033[0m" | Formatting |
| Strikethrough | Strikethrough text | echo "\033[9mStrikethrough\033[0m" | Formatting |
| Bright Black | Bright black (gray) text | echo "\033[90mBright Black\033[0m" | Bright Colors |
| Bright Red | Bright red text | echo "\033[91mBright Red\033[0m" | Bright Colors |
| Bright Green | Bright green text | echo "\033[92mBright Green\033[0m" | Bright Colors |
| Bright Yellow | Bright yellow text | echo "\033[93mBright Yellow\033[0m" | Bright Colors |
| Bright Blue | Bright blue text | echo "\033[94mBright Blue\033[0m" | Bright Colors |
| Bright Magenta | Bright magenta text | echo "\033[95mBright Magenta\033[0m" | Bright Colors |
| Bright Cyan | Bright cyan text | echo "\033[96mBright Cyan\033[0m" | Bright Colors |
| Bright White | Bright white text | echo "\033[97mBright White\033[0m" | Bright Colors |
| Move Up | Move cursor up N lines | echo "\033[5A" # Move up 5 lines | Cursor Control |
| Move Down | Move cursor down N lines | echo "\033[3B" # Move down 3 lines | Cursor Control |
| Move Right | Move cursor right N columns | echo "\033[4C" # Move right 4 cols | Cursor Control |
| Move Left | Move cursor left N columns | echo "\033[2D" # Move left 2 cols | Cursor Control |
| Set Position | Set cursor position (row;col) | echo "\033[10;20H" # Row 10, Col 20 | Cursor Control |
| Clear Screen | Clear entire screen | echo "\033[2J" | Cursor Control |
| Clear Line | Clear current line | echo "\033[2K" | Cursor Control |
| Reset All | Reset all formatting | echo "\033[0m" | Reset |
| Combined | Combine multiple codes | echo "\033[1;31;44mBold Red on Blue\033[0m" | Reset |
| RGB Color (256) | 256-color mode | echo "\033[38;5;82mRGB Text\033[0m" | Reset |
| True Color (RGB) | True color 24-bit | echo "\033[38;2;255;100;0mTrue Color\033[0m" | Reset |