From 2f4656026d553c26510a6744274e4691f842b51c Mon Sep 17 00:00:00 2001 From: JoshuaMKW <60854312+JoshuaMKW@users.noreply.github.com> Date: Wed, 19 Aug 2020 06:32:52 -0500 Subject: [PATCH] Added check in color output to improve performance --- imports/access.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/imports/access.py b/imports/access.py index c516e14..51591da 100644 --- a/imports/access.py +++ b/imports/access.py @@ -88,6 +88,15 @@ def color_text(text: str, textToColor: list=[('', None)], defaultColor: str=None currentColor = None formattedText = '' + format = False + for itemPair in textToColor: + if itemPair[0] != '' or itemPair[1] is not None: + format = True + break + + if not format: + return defaultColor + text + TRESET + for char in text: handled = False for itemPair in textToColor: