diff --git a/slic/utils/cprint.py b/slic/utils/cprint.py index 35a06171..aa08a86f 100644 --- a/slic/utils/cprint.py +++ b/slic/utils/cprint.py @@ -40,3 +40,17 @@ def _print(color, text, sep, kwargs): +# the following creates functions from the COLORS dict which wrap their argument string in a color/reset pair + +def _mk_color_func(color): + def func(text): + return color + text + Fore.RESET + return func + +for name, color in COLORS.items(): + if name is None: + continue + locals()[name] = _mk_color_func(color) + + +