In Python, I want to both (a) use the str.format method to print strings with a fixed width and (b) use yachalk/chalk (see also this answer) to color the output sent to the terminal.
When I use str.format without yachalk, I successfully achieve the fixed-width output. However, when I add yachalk to the mix, I get the colored output I seek, but the strings all run together, ignoring the fixed-width formatting.
Here's my test-case code, followed by screenshot of the terminal output.
Am I doing something wrong? Is yachalk incompatible with str.format?
from yachalk import chalk
s1 = "e4"
s2 = "c5"
s3 = "Nf3"
s = '{:8}'.format(s1) + '{:8}'.format(s2) + '{:8}'.format(s3)
c1 = chalk.yellow(s1)
c2 = chalk.yellow(s2)
c3 = chalk.yellow(s3)
c = '{:8}'.format(c1) + '{:8}'.format(c2) + '{:8}'.format(c3)
print(s)
print(c)