mirror of
https://github.com/tat3r/tdfiglet.git
synced 2024-11-14 12:16:41 +00:00
color code improvements
This commit is contained in:
parent
6d39d31c2c
commit
f4e9b4ca73
12
tdfiglet.c
12
tdfiglet.c
@ -419,11 +419,19 @@ printrow(const glyph_t *glyph, int row)
|
|||||||
char *utfchar;
|
char *utfchar;
|
||||||
uint8_t color;
|
uint8_t color;
|
||||||
int i;
|
int i;
|
||||||
|
uint8_t lastcolor;
|
||||||
|
|
||||||
for (i = 0; i < glyph->width; i++) {
|
for (i = 0; i < glyph->width; i++) {
|
||||||
utfchar = glyph->cell[glyph->width * row + i].utfchar;
|
utfchar = glyph->cell[glyph->width * row + i].utfchar;
|
||||||
color = glyph->cell[glyph->width * row + i].color;
|
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);
|
printf("%s", utfchar);
|
||||||
}
|
}
|
||||||
@ -487,7 +495,7 @@ printstr(const char *str, font_t *font)
|
|||||||
if (opt.color == COLOR_ANSI) {
|
if (opt.color == COLOR_ANSI) {
|
||||||
printf("\x1b[0m\n");
|
printf("\x1b[0m\n");
|
||||||
} else {
|
} else {
|
||||||
printf("\r\n");
|
printf("\x03\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user