Output Effect Format control:
\033[0m Turn off all properties
\033[1m Set High brightness
\03[4m Underline
\033[5m Flashing
\033[7M Reverse Display
\033[8m Hidden
\033[30m--\033[37m set foreground color
\033[40m--\033[47m Set background color
Format control for cursor position and so on:
\033[na cursor up N line
\03[NB cursor Move n line down
\033[NC cursor Right n row
\033[nd Cursor Left n line
\033[Y;XH Set Cursor Position
\033[2J Clear Screen
\033[k clears the contents from the cursor to the end of the line
\033[s Save Cursor position
\033[u Restore cursor Position
\033[?25l Hide Cursor
\33[?25h Display Cursor Collation:
Coded Color/action
0 Reset properties to default settings
1 set Bold
2 Set half brightness (simulate color of color display)
4 Set underline (simulate color of color display)
5 Setting Flicker
7 Setting the reverse image
22 Setting general Density
24 Off underline
25 off flashing
27 Turn off the reverse image
30 setting Black foreground
31 Setting the red foreground
32 Setting Green foreground
33 Setting Brown foreground
34 Setting Blue Foreground
35 Setting Purple foreground
36 Setting Cyan Foreground
37 Setting White foreground
38 underline on the default foreground color
39 Close the underline on the default foreground color
40 Setting black background
41 Setting Red background
42 Setting Green Background
43 Setting Brown background
44 Setting Blue background
45 Setting purple Background
46 Setting Cyan Background
47 Setting white background
49 Setting the default black background
Special effects can be superimposed, need to use ";" Separated, for example: Flashing + underline + white background + black word for \033[5;4;47;30m flashing + underline + white background + black word for \033[0m
Here's a little example
#!/bin/bash # #下面是字体输出颜色及终端格式控制 #字体色范围: 30-37 echo-e "\033[30m black word \033[0m" echo-e "\033[31m red word \033[0m" ECHO-E "\033[3 2m Green character \033[0m "echo-e" \033[33m yellow word \033[0m "echo-e" \033[34m blue word \033[0m "echo-e" \033[35m purple word \033[0m "echo-e" \033 [36m sky blue character \033[0m "echo-e" \033[37m white word \033[0m "#字背景颜色范围: 40-47 echo-e" \033[40;37m black background text \033[0m "ECHO-E" \033[41;30m Red Bottom Black character \033[0m "Echo-e" \033[42;34m Green bottom Blue word \033[0m "echo-e" \033[43;34m yellow bottom Blue word \033[0m "echo-e" \033[44;30m Blue bottom Black word \033[0m "echo -E "\033[45;30m purple bottom black word \033[0m" echo-e "\033[46;30m blue background black word \033[0m" echo-e "\033[47;34m white bottom Blue word \033[0m" #控制选项说明 #\033[0m closes the There are properties #\033[1m set high brightness #\033[4m underline echo-e "\033[4;31m underline red word \033[0m" #闪烁 echo-e "\033[5;34m red word in flashing \033[0m" #反影 echo-e "\03 3[8m hidden \033[0m "#\033[30m-\033[37m set foreground color #\033[40m-\033[47m set background color #\033[na cursor up n line #\033[nb cursor down n row echo-e" \033[4a cursor up 4 lines \033[0m "#\033[nc cursor right n line #\033[nd cursor left n row #\033[y;xh set cursor position #\033[2j clear screen #\033[k purge from cursor to end of line ECHO-E" \033[k clear cursor to end of line \033[0m "#\033[s saves the cursor position #\033[uRestore cursor position #\033[?25| hidden cursor #\033[?25h display cursor ECHO-E "\033[?25l hidden cursor \033[0m" ECHO-E "\033[?25h display cursor \033[0m"