Added check in color output to improve performance
This commit is contained in:
parent
2a7ac8a3d9
commit
2f4656026d
1 changed files with 9 additions and 0 deletions
|
@ -88,6 +88,15 @@ def color_text(text: str, textToColor: list=[('', None)], defaultColor: str=None
|
||||||
currentColor = None
|
currentColor = None
|
||||||
formattedText = ''
|
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:
|
for char in text:
|
||||||
handled = False
|
handled = False
|
||||||
for itemPair in textToColor:
|
for itemPair in textToColor:
|
||||||
|
|
Reference in a new issue