In the shell script, ECHO Displays the content in color, and ECHO Displays the content in color. You need to use the-e parameter.
The format is as follows:
Echo-e "\ 033 [background color; text color M string \ 033 [0 m"
For example:
Echo-e "\ 033 [41; 36 m something here \ 033 [0 m"
The position 41 represents the background color, and the position 36 represents the color of the word.
Note:
...
In the shell script, ECHO Displays the content in color, and ECHO Displays the content in color. You need to use the-e parameter.
The format is as follows:
Echo-e "\ 033 [background color; text color M string \ 033 [0 m"
For example:
Echo-e "\ 033 [41; 36 m something here \ 033 [0 m"
The position 41 represents the background color, and the position 36 represents the color of the word.
Note:
1. The word background color and text color are English ""
2. There is a m behind the text color
3. There can be no spaces before and after the string. If there is space, the output also has space.
The following are the corresponding characters and background colors. You can try to find different colors.
Example
Echo-e "\ 033 [31 m red \ 033 [0m"
Echo-e "\ 033 [34 m yellow word \ 033 [0 m"
Echo-e "\ 033 [41; 33 m red base yellow word \ 033 [0 m"
Echo-e "\ 033 [41; 37 m White text \ 033 [0 m"
Color: 30--37
Echo-e "\ 033 [30 m black character \ 033 [0 m"
Echo-e "\ 033 [31 m red \ 033 [0m"
Echo-e "\ 033 [32 m green word \ 033 [0 m"
Echo-e "\ 033 [33 m yellow word \ 033 [0 m"
Echo-e "\ 033 [34 m blue \ 033 [0 m"
Echo-e "\ 033 [35 m purple word \ 033 [0 m"
Echo-e "\ 033 [36 m sky blue character \ 033 [0 m"
Echo-e "\ 033 [37 m White words \ 033 [0m"
Color Range: 40--47
Echo-e "\ 033 [40; 37 m black white \ 033 [0 m"
Echo-e "\ 033 [41; 37 m White text \ 033 [0 m"
Echo-e "\ 033 [42; 37 m green white \ 033 [0 m"
Echo-e "\ 033 [43; 37 m yellow-bottom white word \ 033 [0 m"
Echo-e "\ 033 [44; 37 m blue white \ 033 [0 m"
Echo-e "\ 033 [45; 37 m purple white \ 033 [0 m"
Echo-e "\ 033 [46; 37 m White text \ 033 [0 m"
Echo-E "\ 033 [47; 30 m White-bottom black \ 033 [0 m"
Description of last-side control options
\ 33 [0 m close all properties
\ 33 [1 m set high brightness
\ 33 [4 m underline
\ 33 [5 m flashing
\ 33 [7 m reverse display
\ 33 [8 m blanking
\ 33 [30 m-\ 33 [37 m sets the foreground color
\ 33 [40 m-\ 33 [47 m set background color
\ 33 [move the NA cursor up n rows
\ 33 [move the Nb cursor down n rows
\ 33 [move the NC cursor right n rows
\ 33 [Nd cursor shifts n rows left
\ 33 [Y; XH: Set the cursor position
\ 33 [2j clear screen
\ 33 [k clear content from cursor to end of line
\ 33 [s Save the cursor position
\ 33 [U restore cursor position
\ 33 [? 25l hide the cursor
\ 33 [? 25 h show cursor
Shell font color <to>