spreadsheet

terminal spreadsheet application
git clone https://git.ce9e.org/spreadsheet.git

commit
adbc8cd0f116dafb81c5fc161b71dd2ae17cf161
parent
d90ffaae9267f48df776fc42dff6fde41f56f453
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-07-20 15:39
use terminfo for styling

Diffstat

M sheet/term.py 12 +++++++++---

1 files changed, 9 insertions, 3 deletions


diff --git a/sheet/term.py b/sheet/term.py

@@ -1,5 +1,11 @@
   -1     1 import boon
    1     2 from wcwidth import wcswidth
    2     3 
   -1     4 RED = boon.get_cap('setaf', 1)
   -1     5 BLUE = boon.get_cap('setaf', 4)
   -1     6 INVERT = boon.get_cap('rev')
   -1     7 RESET = boon.get_cap('sgr0')
   -1     8 
    3     9 
    4    10 def align_right(s, width):
    5    11     w = wcswidth(s)
@@ -24,12 +30,12 @@ def align_center(s, width):
   24    30 
   25    31 
   26    32 def red(s):
   27    -1     return f'\033[31m{s}\033[0m'
   -1    33     return RED + s + RESET
   28    34 
   29    35 
   30    36 def blue(s):
   31    -1     return f'\033[34m{s}\033[0m'
   -1    37     return BLUE + s + RESET
   32    38 
   33    39 
   34    40 def invert(s):
   35    -1     return f'\033[7m{s}\033[0m'
   -1    41     return INVERT + s + RESET