You can join color and bold in to one \033 ansi sequence

This commit is contained in:
jesopo 2018-11-14 12:19:31 +00:00
parent 0e499a4078
commit 76d9face44

View file

@ -201,10 +201,11 @@ def to_ansi_colors(s: str) -> str:
replace += utils.consts.ANSI_BOLD_RESET
color = True
replace += utils.consts.ANSI_FORMAT % foreground.ansi
foreground_s = str(foreground.ansi).zfill(2)
if foreground.color_bold:
color_bold = True
replace += utils.consts.ANSI_BOLD
foreground_s = "%s;1" % foreground_s
replace += utils.consts.ANSI_FORMAT % foreground_s
else:
if color:
replace += utils.consts.ANSI_COLOR_RESET