1. Obtain the coordinates of the current cursor
Declare-I lnum = 0
Getlnum ()
{
Echo-ne '/E [6n'; read-SDR POS
Pos =$ {pos #*[}
Lnum =$ {pos % ;*}
Col =$ {pos ##*;}
}
2. control output
Format: Echo "/033 [text background color; font color M string/033 [0 m"
For example:
Echo "/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.
The ASCII code is the beginning and end of the color call.
/033 [; M ...... /033 [0 m
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
/033 [0 m close all attributes
/033 [1 m set high brightness
/033 [4 m underline
/033 [5 m flashing
/033 [7 m reverse display
/033 [8 m blanking
/033 [30 m --/33 [37 m sets the foreground color
/033 [40 m --/33 [47 m set the background color
/033 [move the NA cursor up n rows
/033 [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
/033 [? 25 h show cursor