From f34ac3b47f793115fb8f78525c3339b548269815 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Fri, 20 Oct 2017 21:10:28 -0400 Subject: [PATCH] multiple styles at the same time and background colors using . eg. blue.yellow underline.blink --- colout/colout.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/colout/colout.py b/colout/colout.py index 641abf5..d492747 100755 --- a/colout/colout.py +++ b/colout/colout.py @@ -521,15 +521,19 @@ def colorin(text, color="red", style="normal"): color_code = "" style_code = "" background_code = "" - + list_style_code = [] + # Convert the style code if style == "random" or style == "Random": style = random.choice(list(context["styles"].keys())) else: - if style in context["styles"]: - style_code = str(context["styles"][style]) - - color_background = color.strip().split("_") + styles = style.split(".") + for astyle in styles: + if astyle in context["styles"]: + list_style_code.append(str(context["styles"][astyle])) + style_code = ";".join(list_style_code) + + color_background = color.strip().split(".") color = color_background[0] background = color_background[1] if len(color_background) == 2 else None