LANGUAGE » SHELL_SCRIPT

ANSI escape

Syntax

  • Start a sequence with \033[ or \e[.
  • Add the codes for the control sequence, separated by ;.
  • Close the sequence with m.

Example:

shell
\033[37;1m

Here we used the codes 37 and 1, which changes the color to white and make it bold.

Common codes

Styling:

CodeDescription
0Reset
1Bold
2Dim
3Italic
4Underline
7Invert BG and FG colors
8Hide text
9Strikethrough

Coloring:

FG codeBG codeColor
3040Black
3141Red
3242Green
3343Yellow
3444Blue
3545Magenta
3646Cyan
3747White