- switch (cell->attr.bg.ccode) {
- case TERM_CCODE_DEFAULT:
- output_printf(o, "\e[49m");
- break;
- case TERM_CCODE_256:
- output_printf(o, "\e[48;5;%um", cell->attr.bg.c256);
- break;
- case TERM_CCODE_RGB:
- output_printf(o, "\e[48;2;%u;%u;%um", cell->attr.bg.red, cell->attr.bg.green, cell->attr.bg.blue);
- break;
- case TERM_CCODE_BLACK ... TERM_CCODE_WHITE:
- output_printf(o, "\e[%um", cell->attr.bg.ccode - TERM_CCODE_BLACK + 40);
- break;
- case TERM_CCODE_LIGHT_BLACK ... TERM_CCODE_LIGHT_WHITE:
- output_printf(o, "\e[%um", cell->attr.bg.ccode - TERM_CCODE_LIGHT_BLACK + 100);
- break;
- }
-
- output_printf(o, "\e[%u;%u;%u;%u;%u;%um",
- cell->attr.bold ? 1 : 22,
- cell->attr.italic ? 3 : 23,
- cell->attr.underline ? 4 : 24,
- cell->attr.inverse ? 7 : 27,
- cell->attr.blink ? 5 : 25,
- cell->attr.hidden ? 8 : 28);
+ switch (attr->fg.ccode) {
+ case TERM_CCODE_DEFAULT:
+ output_printf(o, "\e[39m");
+ break;
+ case TERM_CCODE_256:
+ output_printf(o, "\e[38;5;%um", attr->fg.c256);
+ break;
+ case TERM_CCODE_RGB:
+ output_printf(o, "\e[38;2;%u;%u;%um", attr->fg.red, attr->fg.green, attr->fg.blue);
+ break;
+ case TERM_CCODE_BLACK ... TERM_CCODE_WHITE:
+ output_printf(o, "\e[%um", attr->fg.ccode - TERM_CCODE_BLACK + 30);
+ break;
+ case TERM_CCODE_LIGHT_BLACK ... TERM_CCODE_LIGHT_WHITE:
+ output_printf(o, "\e[%um", attr->fg.ccode - TERM_CCODE_LIGHT_BLACK + 90);
+ break;
+ }