From f4e9b4ca73338b746a81fc6b289d91cf1fe284af Mon Sep 17 00:00:00 2001 From: tater Date: Sun, 24 Jun 2018 06:39:33 -0500 Subject: [PATCH] color code improvements --- tdfiglet.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tdfiglet.c b/tdfiglet.c index 8f47e14..e8e45d5 100644 --- a/tdfiglet.c +++ b/tdfiglet.c @@ -419,11 +419,19 @@ printrow(const glyph_t *glyph, int row) char *utfchar; uint8_t color; int i; + uint8_t lastcolor; for (i = 0; i < glyph->width; i++) { utfchar = glyph->cell[glyph->width * row + i].utfchar; color = glyph->cell[glyph->width * row + i].color; - printcolor(color); + + if (i == 0) { + printcolor(color); + lastcolor = color; + } else if (color != lastcolor) { + printcolor(color); + lastcolor = color; + } printf("%s", utfchar); } @@ -487,7 +495,7 @@ printstr(const char *str, font_t *font) if (opt.color == COLOR_ANSI) { printf("\x1b[0m\n"); } else { - printf("\r\n"); + printf("\x03\r\n"); } } }