static void write_sgr(uint32_t fg, uint32_t bg) { char buf[32]; WRITE_LITERAL("\033[3"); WRITE_INT(fg); WRITE_LITERAL(";4"); WRITE_INT(bg); WRITE_LITERAL("m"); }
static void write_cursor(unsigned x, unsigned y) { char buf[32]; WRITE_LITERAL("\033["); WRITE_INT(y+1); WRITE_LITERAL(";"); WRITE_INT(x+1); WRITE_LITERAL("H"); }
static void write_cursor(int x, int y) { char buf[32]; WRITE_LITERAL("\033["); WRITE_INT(y+1); WRITE_LITERAL(";"); WRITE_INT(x+1); WRITE_LITERAL("H"); }
static void write_sgr(uint16_t fg, uint16_t bg) { char buf[32]; if (fg == TB_DEFAULT && bg == TB_DEFAULT) return; switch (outputmode) { case TB_OUTPUT_256: case TB_OUTPUT_216: case TB_OUTPUT_GRAYSCALE: WRITE_LITERAL("\033["); if (fg != TB_DEFAULT) { WRITE_LITERAL("38;5;"); WRITE_INT(fg); if (bg != TB_DEFAULT) { WRITE_LITERAL(";"); } } if (bg != TB_DEFAULT) { WRITE_LITERAL("48;5;"); WRITE_INT(bg); } WRITE_LITERAL("m"); break; case TB_OUTPUT_NORMAL: default: WRITE_LITERAL("\033["); if (fg != TB_DEFAULT) { WRITE_LITERAL("3"); WRITE_INT(fg - 1); if (bg != TB_DEFAULT) { WRITE_LITERAL(";"); } } if (bg != TB_DEFAULT) { WRITE_LITERAL("4"); WRITE_INT(bg - 1); } WRITE_LITERAL("m"); break; } }
static void write_sgr_bg(uint16_t bg) { char buf[32]; WRITE_LITERAL("\033[4"); WRITE_INT(bg-1); WRITE_LITERAL("m"); }
static void write_sgr_fg(uint16_t fg) { char buf[32]; WRITE_LITERAL("\033[3"); WRITE_INT(fg-1); WRITE_LITERAL("m"); }