From 67ca71ee188975398ed5f5039755ff7d1f2b152c Mon Sep 17 00:00:00 2001 From: Gordon Shumway <39967334+oddluck@users.noreply.github.com> Date: Tue, 21 May 2019 06:12:04 -0400 Subject: [PATCH] img: handle digit first character in line --- ASCII/plugin.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ASCII/plugin.py b/ASCII/plugin.py index 233744b..a0191f2 100644 --- a/ASCII/plugin.py +++ b/ASCII/plugin.py @@ -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: