In the Linux system, the shell command can efficiently run concurrent processing tasks, and the shell script is not boring. There are not only magic sounds but also the color display of the shell. Next, we will use the colors in the shell to improve the quality of the shell script in seconds. |
Let's take an example:
echo -e"\033[44;37;5m ME \033[0m COOL"
The above command sets the background to blue, the foreground to white, blinks the cursor, and outputs the character "ME", then resets the screen to the default setting and outputs the character "COOL". "e" is an optional option of the command echo, which is used to activate the parser for special characters. "\033" leads an unconventional character sequence. "m" means to set the property and end the sequence of unconventional characters, the real valid characters in this example are "44;37;5" and "0". Modifying "44;37;5" can generate a combination of different colors, and the numerical value has nothing to do with the sequence of coding.
Color Coded Meaning
Encode Color/Action 0 reset attribute to default 1 set bold 2 set half brightness (simulate color display color) 4 set underline (simulate color display color) 5 set flashing 7 set inverted image 22 set normal density 24 turn off underline 25 turn off flashing 27 turn off reverse image 30 set black foreground 31 set red foreground 32 set green foreground 33 set brown foreground 34 set blue foreground 35 set purple foreground 36 set cyan foreground 37 set white foreground 38 in default Set underline on foreground color 39 Turn off underline on default foreground color 40 Set black background 41 Set red background 42 Set green background 43 Set brown background 44 Set blue background 45 Set purple background 46 Set cyan background 47 Set white background 49 Set default black background
Color coded for use with
echo -e "\033[31m red characters\033[0m" echo -e "\033[34m yellow characters\033[0m" echo -e "\033[41;33m red background yellow characters\033[0m" echo -e "\033[41;37m white text on red background\033[0m"
Linux font color 30--37
echo -e "\033[30m black characters\033[0m" echo -e "\033[31m red characters\033[0m" echo -e "\033[32m green characters\033[0m" echo -e "\ 033[33m yellow characters\033[0m" echo -e "\033[34m blue characters\033[0m" echo -e "\033[35m purple characters\033[0m" echo -e "\033[36m sky blue Word \033[0m" echo -e "\033[37m white word\033[0m"
Linux font background color 40—–47
echo -e "\033[40;37m white on black\033[0m" echo -e "\033[41;37m white on red\033[0m" echo -e "\033[42;37m white on green\ 033[0m" echo -e "\033[43;37m white characters on yellow background\033[0m" echo -e "\033[44;37m white characters on blue background\033[0m" echo -e "\033[45;37m White on purple \033[0m" echo -e "\033[46;37m White on sky blue \033[0m" echo -e "\033[47;30m Black on white\033[0m"
Color-coded font flashes:
echo -e "\033[42;30;5m wwww \033[0m" echo -e "\033[47;30;5m wwww \033[0m"