Skip to content

Instantly share code, notes, and snippets.

@DevGW
Last active March 2, 2023 14:04
Show Gist options
  • Save DevGW/0655e27e8eaa68543984b172e6bbe6e6 to your computer and use it in GitHub Desktop.
Save DevGW/0655e27e8eaa68543984b172e6bbe6e6 to your computer and use it in GitHub Desktop.
ANSI terminal color codes #ANSI
\033[XXm
30 black 90 gray
31 red 91 bright red
32 green 92 bright green
33 yellow 93 bright yellow
34 blue 94 bright blue
35 magenta 95 bright magenta
36 cyan 96 bright cyan
37 white 97 bright white
\033[49m - Reset colour
\033[2K - Clear Line
\033[<L>;<C>H OR \033[<L>;<C>f puts the cursor at line L and column C.
\033[<N>A Move the cursor up N lines
\033[<N>B Move the cursor down N lines
\033[<N>C Move the cursor forward N columns
\033[<N>D Move the cursor backward N columns
\033[2J Clear the screen, move to (0,0)
\033[K Erase to end of line
\033[s Save cursor position
\033[u Restore cursor position
\033[4m Underline on
\033[24m Underline off
\033[1m Bold on
\033[21m Bold off
Code Effect Note
0 Reset / Normal all attributes off
1 Bold or increased intensity
2 Faint (decreased intensity) Not widely supported.
3 Italic Not widely supported. Sometimes treated as inverse.
4 Underline
5 Slow Blink less than 150 per minute
6 Rapid Blink MS-DOS ANSI.SYS; 150+ per minute; not widely supported
7 [[reverse video]] swap foreground and background colors
8 Conceal Not widely supported.
9 Crossed-out Characters legible, but marked for deletion. Not widely supported.
10 Primary(default) font
11–19 Alternate font Select alternate font n-10
20 Fraktur hardly ever supported
21 Bold off or Double Underline Bold off not widely supported; double underline hardly ever supported.
22 Normal color or intensity Neither bold nor faint
23 Not italic, not Fraktur
24 Underline off Not singly or doubly underlined
25 Blink off
27 Inverse off
28 Reveal conceal off
29 Not crossed out
30–37 Set foreground color See color table below
38 Set foreground color Next arguments are 5;<n> or 2;<r>;<g>;<b>, see below
39 Default foreground color implementation defined (according to standard)
40–47 Set background color See color table below
48 Set background color Next arguments are 5;<n> or 2;<r>;<g>;<b>, see below
49 Default background color implementation defined (according to standard)
51 Framed
52 Encircled
53 Overlined
54 Not framed or encircled
55 Not overlined
60 ideogram underline hardly ever supported
61 ideogram double underline hardly ever supported
62 ideogram overline hardly ever supported
63 ideogram double overline hardly ever supported
64 ideogram stress marking hardly ever supported
65 ideogram attributes off reset the effects of all of 60-64
90–97 Set bright foreground color aixterm (not in standard)
100–107 Set bright background color aixterm (not in standard)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment