diff --git a/src/music_kraken/utils/__init__.py b/src/music_kraken/utils/__init__.py index 89186a6..94ef04c 100644 --- a/src/music_kraken/utils/__init__.py +++ b/src/music_kraken/utils/__init__.py @@ -1 +1,20 @@ 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() diff --git a/src/music_kraken/utils/enums/colors.py b/src/music_kraken/utils/enums/colors.py index 44f79da..a9fac51 100644 --- a/src/music_kraken/utils/enums/colors.py +++ b/src/music_kraken/utils/enums/colors.py @@ -1,7 +1,7 @@ from enum import Enum -class BColors: +class BColors(Enum): # https://stackoverflow.com/a/287944 HEADER = "\033[95m" OKBLUE = "\033[94m"