Color is selected by adding a special sequence --
Basically
"/E ["
And
"M"
Between numeric values. If more than one numeric code is specified, separate them with semicolons.
Echo-e "/E [31; 40 m"
First digit (31)
Foreground color
(
Red
)
; The second digit is
(40)
Background Color
(
Black
)
Echo-e"
/E
[0 m"
We need to use "/E [0 m"
The sequence resets the color to the normal value.
/033 [30 m --/033 [37 m sets the foreground color
(
Font color
)
/033 [30 m change the color of the character to black
/033 [31 m change the color of the character to red
/033 [32 m change the color of the character to green
/033 [33 m change the color of the character to light red
/033 [34 m
Change the color of the character to blue.
/033 [35 m change the character color to purple
/033 [36 m change the character color to light blue
/033 [37 m change the color of the character to gray
/033 [40 m --/033 [47 m set the background color
/033 [40 m set the background color to black
/033 [41 m set the background color to red
/033 [42 m set the background color to green
/033 [43 m set the background color to light red
/033 [44 m set the background color to blue
/033 [45 m set the background color to purple
/033 [46 m set the background color to light blue
/033 [47 m set the background color to gray
Example: ECHO-ne "/033 [32 m"
You can change the color of characters to green.
Printf () color settings
--------------------------------------
Echo-e "/033 [1; 33 m Hello world./033 [0 M/N"
The color is as follows:
None = "/033 [0 m"
Black = "/033 [0; 30 m"
Dark_gray = "/033 [1; 30 m"
Blue = "/033 [0; 34 m"
Light_blue = "/033 [1; 34 m"
Green = "/033 [0; 32 m"
Light_green
-
= "/033 [1; 32 m"
Cyan = "/033 [0; 36 m"
Light_cyan = "/033 [1; 36 m"
Red = "/033 [0; 31 m"
Light_red = "/033 [1; 31 m"
Purple = "/033 [0; 35 m"
Light_purple = "/033 [1; 35 m"
Brown = "/033 [0; 33 m"
Yellow = "/033 [1; 33 m"
Light_gray = "/033 [0; 37 m"
White = "/033 [1; 37 m"