From 2d18e7e5f0deb556a620d450530063e8468525e6 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 22 Oct 2020 18:08:08 +0200 Subject: [PATCH] Add color class --- src/util/color.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/util/color.py diff --git a/src/util/color.py b/src/util/color.py new file mode 100644 index 0000000..dc4c785 --- /dev/null +++ b/src/util/color.py @@ -0,0 +1,21 @@ +from src.util import command + + +class Color: + def get_256_color(color): + """Get color using tput (256-colors base)""" + return command.get_output(f'tput setaf {color}') + + def get_special_color(index): + """Get special colors using tput (like bold, etc..)""" + return command.get_output(f'tput {index}') + + RED = get_256_color(196) + BLUE = get_256_color(51) + GREEN = get_256_color(46) + YELLOW = get_256_color(226) + GOLD = get_256_color(214) + GREY = get_256_color(238) + + RESET = get_special_color('sgr0') + BOLD = get_special_color('bold')