diff --git a/src/util/color.py b/src/util/color.py index bcbef4f..3eaad11 100644 --- a/src/util/color.py +++ b/src/util/color.py @@ -1,21 +1,22 @@ 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_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) +def get_special_color(index): + """Get special colors using tput (like bold, etc..)""" + return command.get_output(f"tput {index}") - RESET = get_special_color("sgr0") - BOLD = get_special_color("bold") + +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") diff --git a/src/util/user.py b/src/util/user.py index 09baaaa..5e250f1 100644 --- a/src/util/user.py +++ b/src/util/user.py @@ -1,36 +1,36 @@ import typing as t -from src.util.color import Color +from src.util import color class Print: def question(question: str, options: t.Optional[list] = None) -> None: """Print syntax for question with optional `options` to it""" - text = [f"{Color.GREEN} // {question}{Color.RESET}"] + text = [f"{color.GREEN} // {question}{color.RESET}"] if options: for option in options: - text.append(f"{Color.GREEN} # {option}{Color.RESET}") + text.append(f"{color.GREEN} # {option}{color.RESET}") print("\n".join(text)) def action(action: str) -> None: """Print syntax for action""" - print(f"{Color.GOLD} >> {action}{Color.RESET}") + print(f"{color.GOLD} >> {action}{color.RESET}") def err(text: str) -> None: """Print syntax for error""" - print(f"\n{Color.RED} !! {text}{Color.RESET}") + print(f"\n{color.RED} !! {text}{color.RESET}") def cancel(text: str) -> None: """Print syntax for cancellation""" - print(f"{Color.GREY} >> {text}{Color.RESET}") + print(f"{color.GREY} >> {text}{color.RESET}") def comment(text: str) -> None: """Print syntax for comments""" - print(f"{Color.GREY} // {text}{Color.RESET}") + print(f"{color.GREY} // {text}{color.RESET}") def warning(text: str) -> None: """Print syntax for warnings""" - print(f"{Color.YELLOW} ** {text}{Color.RESET}") + print(f"{color.YELLOW} ** {text}{color.RESET}") class Input: