Coding style.
- termstr no longer depends on terminal. - Moved some code from terminal to termstr.
This commit is contained in:
parent
d540636fd5
commit
5341d91592
2 changed files with 31 additions and 32 deletions
|
|
@ -8,12 +8,6 @@ import termios
|
|||
ESC = "\x1b"
|
||||
MOUSE = ESC + "[M"
|
||||
|
||||
normal = "[m"
|
||||
bold = "[1m"
|
||||
italic = "[3m"
|
||||
standout = "[7m"
|
||||
underline = "[4m"
|
||||
|
||||
UP_KEY = ESC + "[A"
|
||||
DOWN_KEY = ESC + "[B"
|
||||
RIGHT_KEY = ESC + "[C"
|
||||
|
|
@ -24,14 +18,6 @@ HOME_KEY = ESC + "[H"
|
|||
END_KEY = ESC + "[F"
|
||||
|
||||
|
||||
def color(color_number, is_foreground):
|
||||
return f"[{'38' if is_foreground else '48'};5;{color_number:d}m"
|
||||
|
||||
|
||||
def rgb_color(rgb, is_foreground):
|
||||
return f"[{'38' if is_foreground else '48'};2;" + "%i;%i;%im" % rgb
|
||||
|
||||
|
||||
def move(x, y):
|
||||
return ESC + f"[{y + 1:d};{x + 1:d}H"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue