feat: implemented global input output functions

This commit is contained in:
Hazel 2024-01-29 09:24:47 +01:00
parent 0fedfd880e
commit 430554a570
2 changed files with 20 additions and 1 deletions

View File

@ -1 +1,20 @@
from .config import config, read_config, write_config from .config import config, read_config, write_config
from .enums.colors import BColors
"""
Here are all global important functions.
"""
def _apply_color(msg: str, color: BColors) -> str:
if color is BColors.ENDC:
return msg
return color.value + msg + BColors.ENDC.value
def output(msg: str, color: BColors = BColors.ENDC):
print(_apply_color(msg, color))
def user_input(msg: str, color: BColors = BColors.ENDC):
return input(_apply_color(msg, color)).strip()

View File

@ -1,7 +1,7 @@
from enum import Enum from enum import Enum
class BColors: class BColors(Enum):
# https://stackoverflow.com/a/287944 # https://stackoverflow.com/a/287944
HEADER = "\033[95m" HEADER = "\033[95m"
OKBLUE = "\033[94m" OKBLUE = "\033[94m"