Format: echo "/033[word background color; font color m string/033[control code"
If you simply display the font color can be fixed control code bit 0m.
Format: echo "/033[word background color; font Color m string/033[0m"
Note:
1, the word background color and the text color is in English ""
2. There is a m behind the text color
3, before and after the string can have no space, if any, the output is also a space
Word background color range: 40-49
40: Black
41: Crimson
42: Green
43: Yellow
44: Blue
45: Purple
46: Dark Green
47: White
The code is as follows:
Echo-e "\033[40;37m Black Bottom White \033[0m"
Echo-e "\033[41;37m Red bottom White \033[0m"
Echo-e "\033[42;37m Green bottom White \033[0m"
Echo-e "\033[43;37m Yellow \033[0m"
Echo-e "\033[44;37m Blue bottom White \033[0m"
Echo-e "\033[45;37m Purple \033[0m"
Echo-e "\033[46;37m sky blue Bottom White \033[0m"
Echo-e "\033[47;30m black character \033[0m on white background"
Note: You can change all 033 to E.
Example: Echo-e "\033[40;37m Black Bottom White \033[0m"
Echo-e "\e[40;37m Black Bottom White \e[0m"
The effect is the same.
Word Color: 30-39
30: Black
31: Red
32: Green
33: Yellow
34: Blue
35: Purple
36: Dark Green
37: White
The code is as follows:
Echo-e "\033[47;30m black character \033[0m on white background"
Echo-e "\033[31m Red word \033[0m"
Echo-e "\033[32m Green word \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 Word \033[0m"
Echo-e "\033[37m White character \033[0m"
ANSI Control code
\33[0m Close All Properties
\33[01m Setting High brightness
\33[04m Underline
\33[05m Flashing
\33[07M Reverse Display
\33[08m blanking
\33[30m--\33[37m setting foreground color
\33[40m--\33[47m Set background color
\33[na the cursor to move n rows
\33[NB cursor down n rows
\33[NC cursor right shifts n rows
\33[nd cursor left n rows
\33[Y;XH Setting the cursor position
\33[2J Clear Screen
\33[k clears the contents from the cursor to the end of the line
\33[s Save Cursor position
\33[u Restore cursor Position
\33[?25l Hide Cursor
\33[?25h Display cursor
For example:
Turn the font into red and keep flashing
#echo-E "\033[31m \033[05m please confirm your operation, enter [y/n] \033[0m"
This article is from the "burning Years of Passion" blog, please be sure to keep this source http://liuzhengwei521.blog.51cto.com/4855442/1771866
Shell script Display color settings