Skip navigation Main Doom Git Guide ANSI Colors Startpage

ANSI color codes cheatsheet

\x1b and \033 are both escaped string codes for the ASCII escape character. After the escape character, the sequence [<code numbers...>m is used to signal ASCII color codes. Multiple codes can be used by separating them with a semicolon. For example, \x1b[1;2;3m will apply the effects 1, 2, and 3.

Effects

Effect Code
Reset \x1b[0m
Bold \x1b[1m
Faint \x1b[2m
Italic \x1b[3m
Underline \x1b[4m
\x1b[5m
\x1b[6m
Highlight \x1b[7m
\x1b[8m
Strikethrough \x1b[9m

Basic color codes

Color Dark Light
FG BG FG BG
Black (BG) \x1b[30m \x1b[40m \x1b[90m \x1b[100m
Red \x1b[31m \x1b[41m \x1b[91m \x1b[101m
Green \x1b[32m \x1b[42m \x1b[92m \x1b[102m
Yellow \x1b[33m \x1b[43m \x1b[93m \x1b[103m
Blue \x1b[34m \x1b[44m \x1b[94m \x1b[104m
Purple \x1b[35m \x1b[45m \x1b[95m \x1b[105m
Cyan \x1b[36m \x1b[46m \x1b[96m \x1b[106m
White (FG) \x1b[37m \x1b[47m \x1b[97m \x1b[107m