OSDN Git Service

Regular updates
[twpd/master.git] / ansi.md
1 ---
2 title: Ansi codes
3 category: CLI
4 layout: 2017/sheet
5 intro: |
6   Quick reference to ANSI color codes.
7 ---
8
9 ### Format
10
11 ```
12 \033[#m
13 ```
14
15 ### ANSI codes
16
17 ```
18 0      clear
19 1      bold
20 4      underline
21 5      blink
22
23 30-37  fg color
24 40-47  bg color
25
26 1K     clear line (to beginning of line)
27 2K     clear line (entire line)
28 2J     clear screen
29 0;0H   move cursor to 0;0
30
31 1A     move up 1 line
32 ```
33
34 ### Colors
35
36 ```
37 0      black
38 1      red
39 2      green
40 3      yellow
41 4      blue
42 5      magenta
43 6      cyan
44 7      white
45 ```
46
47 ### Bash utilities
48
49 ```sh
50 hide_cursor() { printf "\e[?25l"; }
51 show_cursor() { printf "\e[?25h"; }
52 ```