mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Don't use irrelevant class for colors
This commit is contained in:
parent
a47c660fff
commit
28f9eb1545
|
@ -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")
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue