Printf ("/033 [text background color; font color M string/033 [0 m ");
Printf ("/033 [41; 32 m font background is red, the word is green/033 [0 M/N ");
41 is the background color, 32 is the font color, the font background is red, the word is green is the string, and the following/033 [0 m is the control code.
Color Code:
Quote:
Color Range: 40--49 color: 30--39
40: Black 30: Black
41: Red 31: red
42: Green 32: Green
43: yellow 33: Yellow
44: Blue 34: Blue
45: Purple 35: Purple
46: dark green 36: dark green
47: White 37: white
ANSI control code:
Quote:
/033 [0 m close all attributes
/033 [1 m set high brightness
/03 [4 m underline
/033 [5 m flashing
/033 [7 m reverse display
/033 [8 m blanking
/033 [30 m --/033 [37 m sets the foreground color
/033 [40 m --/033 [47 m set the background color
/033 [move the NA cursor up n rows
/03 [move the Nb cursor down n rows
/033 [the NC cursor shifts n rows right
/033 [Nd cursor shifts n rows left
/033 [Y; XH: Set the cursor position
/033 [2j clear screen
/033 [k clear content from the cursor to the end of the line
/033 [s Save the cursor position
/033 [U restore cursor position
/033 [? 25l hide the cursor
/33 [? 25 h show cursor
In this way, dynamic output can be achieved in some cases.