From 50c780969d780572084033d5c91ac5e92acedff7 Mon Sep 17 00:00:00 2001 From: iou1name Date: Tue, 28 Nov 2017 02:11:59 -0500 Subject: [PATCH] added 'no color' code to end of ansi color outs to avoid fucking up terminals --- ascii.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ascii.py b/ascii.py index c03ff58..8927844 100755 --- a/ascii.py +++ b/ascii.py @@ -142,7 +142,11 @@ def colorize(chars, image, code): new_row += prefix[code] + char_color(image.getpixel((k,j)), code) new_row += chars[j][k] chars[j] = new_row - return "\n".join(chars) + + chars = "\n".join(chars) + if code == "ansi": + chars += "\033[0m" + return chars def image_to_ascii(image, reverse=False, colors=None):