Skip to content
🛠️ToolsShed

Terminal Color Reference

ANSI terminal color escape codes reference and preview.

Foreground Colors

PreviewEscape CodeCode
Black\e[30mFG: 30
Red\e[31mFG: 31
Green\e[32mFG: 32
Yellow\e[33mFG: 33
Blue\e[34mFG: 34
Magenta\e[35mFG: 35
Cyan\e[36mFG: 36
White\e[37mFG: 37

Bright/Bold

PreviewEscape CodeCode
Bright Black\e[90mFG: 90
Bright Red\e[91mFG: 91
Bright Green\e[92mFG: 92
Bright Yellow\e[93mFG: 93
Bright Blue\e[94mFG: 94
Bright Magenta\e[95mFG: 95
Bright Cyan\e[96mFG: 96
Bright White\e[97mFG: 97

Background Colors

PreviewEscape CodeCode
Black BG\e[40mBG: 40
Red BG\e[41mBG: 41
Green BG\e[42mBG: 42
Yellow BG\e[43mBG: 43
Blue BG\e[44mBG: 44
Magenta BG\e[45mBG: 45
Cyan BG\e[46mBG: 46
White BG\e[47mBG: 47

Text Styles

PreviewEscape CodeCode
Bold\e[1m1
Dim\e[2m2
Italic\e[3m3
Underline\e[4m4
Blink\e[5m5
Reverse\e[7m7

Custom Escape Code Builder

Output

\e[32mHello, World!\e[0m

About this tool

The ANSI Terminal Color Reference is a quick lookup and live preview for the escape codes that add color and style to terminal output. Those codes are cryptic sequences that are hard to remember, so this tool turns them into something you can simply browse and see.

Scan the foreground colors, background colors, and text styles like bold and underline, watch the live preview update, and copy the exact escape sequence for whatever you want. It is handy when building CLI tools, writing shell scripts, formatting log output, or colorizing program messages.

A useful tip: combine a foreground color, a background color, and a style code, and always add a reset at the end so later text is not affected. Everything runs locally in your browser, with nothing sent to a server.

Frequently Asked Questions

Code Implementation

# ANSI terminal colors in Python
import sys

# Basic colors
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
BLUE = '\033[34m'
RESET = '\033[0m'
BOLD = '\033[1m'

print(f"{RED}Error: Something went wrong{RESET}")
print(f"{GREEN}Success: Operation completed{RESET}")
print(f"{YELLOW}Warning: Check your input{RESET}")
print(f"{BOLD}{BLUE}Info: Starting process...{RESET}")

# Cross-platform (use colorama for Windows support)
# pip install colorama
try:
    from colorama import Fore, Back, Style, init
    init(autoreset=True)
    print(Fore.RED + 'Red text')
    print(Back.GREEN + Fore.BLACK + 'Green background')
    print(Style.BRIGHT + 'Bold text')
except ImportError:
    # Fallback to direct ANSI codes
    print('\033[31mRed text\033[0m')

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.