From 5925aca3c267af2f19dc9c04479484dc4c2dfe1d Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Wed, 18 Sep 2019 20:02:39 -0700 Subject: [PATCH] Allow strings to be passed to print_colored() --- scripts/wk/std.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/wk/std.py b/scripts/wk/std.py index 96da0c08..b78743c3 100644 --- a/scripts/wk/std.py +++ b/scripts/wk/std.py @@ -807,6 +807,12 @@ def print_colored(strings, colors, **kwargs): 'flush': kwargs.get('flush', False), } + # Convert to tuples if necessary + if isinstance(strings, str): + strings = (strings,) + if isinstance(colors, str): + colors = (colors,) + # Build new string with color escapes added for string, color in itertools.zip_longest(strings, colors): color_code = COLORS.get(color, clear_code)