Free tool · ANSI colors
ANSI color code generator
Choose a foreground, a background, and text styles. Copy the escape sequence in the syntax your script uses.
printf '\e[1;96m%s\e[0m\n' 'Hello from Termany'echo -e "\033[1;96mHello from Termany\033[0m"print("\033[1;96mHello from Termany\033[0m")console.log('\x1b[1;96mHello from Termany\x1b[0m');ESC[1;96m … ESC[0mHow ANSI escape codes work
Terminals read a Control Sequence Introducer — ESC followed by [ — then a list of Select Graphic Rendition (SGR) parameters separated by semicolons, ending in m. For example ESC[1;31m switches to bold red, and ESC[0m resets everything.
Three ways to pick a color
Pick the color depth your audience’s terminals support.
- 16 colors: codes 30–37 and 90–97 for foreground, 40–47 and 100–107 for background. Every terminal supports them, and themes remap them.
- 256 colors: 38;5;N for foreground and 48;5;N for background, with N from 0 to 255.
- Truecolor: 38;2;R;G;B and 48;2;R;G;B. Supported by most modern terminals, including Termany.
Writing ESC in your language
ESC is byte 0x1B. In Bash printf use \e or \033, in Python use \033 or \x1b, and in JavaScript use \x1b or \u001b. Always end colored output with a reset so the next prompt is not tinted.
Frequently asked questions
Why do my colors look different in another terminal?
The 16 basic colors are remapped by the terminal theme. Use 256-color or truecolor codes when you need an exact shade.
How do I reset colors?
Print ESC[0m. It resets the foreground, background, and every style at once.
Does Windows support ANSI codes?
Windows Terminal and modern Windows 10/11 consoles support them. Older consoles need virtual terminal processing enabled.