Add color class

This commit is contained in:
ItsDrike 2020-10-22 18:08:08 +02:00
parent d6a7e34ac4
commit 2d18e7e5f0
No known key found for this signature in database
GPG key ID: F4E8FF4F6AC7F3B4

21
src/util/color.py Normal file
View file

@ -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')