img: handle digit first character in line

This commit is contained in:
Gordon Shumway 2019-05-21 06:12:04 -04:00 committed by GitHub
parent 2365a81f01
commit 67ca71ee18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -619,9 +619,16 @@ class ASCII(callbacks.Plugin):
color = self.getAverageC(colormap[j][i].tolist(), speed)
old_color = color
if 'bg' not in optlist:
aimg[j] += "\x03{0}{1}".format(int(color), gsval)
if gsval.isdigit():
aimg[j] += "\x03{0}{1}".format(color, gsval)
else:
aimg[j] += "\x03{0}{1}".format(int(color), gsval)
else:
aimg[j] += "\x03{0},{1}{2}".format(int(color), int(bg), gsval)
if gsval.isdigit():
newbg = "{:02d}".format(int(bg))
aimg[j] += "\x03{0},{1}{2}".format(int(color), newbg, gsval)
else:
aimg[j] += "\x03{0},{1}{2}".format(int(color), int(bg), gsval)
elif 'nocolor' not in optlist and gsval != ' ':
color = self.getAverageC(colormap[j][i].tolist(), speed)
if color != old_color: