mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Colorize around text (#16415)
Avoid to colorize separately `lead`, equals sign and `num` and separate them by coloring characters.
This commit is contained in:
parent
2b28beb1d7
commit
ba2d1d0bc4
1 changed files with 3 additions and 3 deletions
|
@ -78,10 +78,10 @@ def stringc(text, color):
|
|||
|
||||
def colorize(lead, num, color):
|
||||
""" Print 'lead' = 'num' in 'color' """
|
||||
s = u"%s=%-4s" % (lead, str(num))
|
||||
if num != 0 and ANSIBLE_COLOR and color is not None:
|
||||
return u"%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color))
|
||||
else:
|
||||
return u"%s=%-4s" % (lead, str(num))
|
||||
s = stringc(s, color)
|
||||
return s
|
||||
|
||||
def hostcolor(host, stats, color=True):
|
||||
if ANSIBLE_COLOR and color:
|
||||
|
|
Loading…
Reference in a new issue