You can join color and bold in to one \033 ansi sequence
This commit is contained in:
parent
0e499a4078
commit
76d9face44
1 changed files with 3 additions and 2 deletions
|
@ -201,10 +201,11 @@ def to_ansi_colors(s: str) -> str:
|
||||||
replace += utils.consts.ANSI_BOLD_RESET
|
replace += utils.consts.ANSI_BOLD_RESET
|
||||||
|
|
||||||
color = True
|
color = True
|
||||||
replace += utils.consts.ANSI_FORMAT % foreground.ansi
|
foreground_s = str(foreground.ansi).zfill(2)
|
||||||
if foreground.color_bold:
|
if foreground.color_bold:
|
||||||
color_bold = True
|
color_bold = True
|
||||||
replace += utils.consts.ANSI_BOLD
|
foreground_s = "%s;1" % foreground_s
|
||||||
|
replace += utils.consts.ANSI_FORMAT % foreground_s
|
||||||
else:
|
else:
|
||||||
if color:
|
if color:
|
||||||
replace += utils.consts.ANSI_COLOR_RESET
|
replace += utils.consts.ANSI_COLOR_RESET
|
||||||
|
|
Loading…
Reference in a new issue