Format: echo -e "\033[word background color; font color m string\033[0m"

 

 

Format: echo -e "\033[word background color; font color m string \033[0m" 

For example: 
echo -e "\033[41;36m something here \033[0m" 

The position of 41 represents the background color, The position of 36 represents the color of the word. 


Those ascii codes are the beginning and end of the color call. 
\033[ ; m …… \033[0m 



Word background color range: 40----49 
40: black 
41: dark red 
42: green 
43: yellow 
44: blue 
45: purple 
46: dark green 
47: white 

color: 30-------------39 
30: black 
31: red 
32: green 
33: yellow 
34: blue 
35 : purple 
36: dark green 
37: white 

========================================= ====== ANSI control code description 
\33[0m close all properties 
\33[1m set highlight 
\33[4m underline 
\33[5m flash 
\33[7m inverse 
\33[8m blank 
\33[ 30m -- \33[37m set foreground color 
\33[40m -- \33[47m 设置背景色 
\33[nA 光标上移n行 
\33[nB 光标下移n行 
\33[nC 光标右移n行 
\33[nD 光标左移n行 
\33[y;xH设置光标位置 
\33[2J 清屏 
\33[K 清除从光标到行尾的内容 
\33[s 保存光标位置 
\33[u 恢复光标位置 
\33[?25l 隐藏光标 
\33[?25h 显示光标

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326688627&siteId=291194637