From 8662a3dc0820c9e2811658e4b490ef67a4eee3dc Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Fri, 23 Feb 2024 13:02:03 -0800 Subject: add static text module --- panel.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'panel.py') diff --git a/panel.py b/panel.py index b522dc5..0248838 100755 --- a/panel.py +++ b/panel.py @@ -84,6 +84,18 @@ class Mod: def process_cmd(self, cmd): pass +class ModText(Mod): + def __init__(self, text, fg=None, bg=None, padding=0, **kwargs): + super().__init__(**kwargs) + buf = text + if padding: + buf = Fmt.pad(buf, padding) + if fg: + buf = Fmt.fg(fg, buf) + if bg: + buf = Fmt.bg(bg, buf) + self.out = buf + class ModRight(Mod): def __init__(self, **kwargs): kwargs.setdefault('spacing', 0) -- cgit v1.2.3-70-g09d2