ansi.h (1179B)
1#ifndef ANSI_H 2#define ANSI_H 3 4/* ANSI terminal escape sequences. */ 5 6static char const bold_on[] = "\x1b[1m", bold_off[] = "\x1b[22m"; /* not a typo */ 7static char const underline_on[] = "\x1b[4m", underline_off[] = "\x1b[24m"; 8static char const inverse_video_on[] = "\x1b[7m", inverse_video_off[] = "\x1b[27m"; 9static char const clear_screen[] = "\x1b[2J"; 10static char const clear_line[] = "\x1b[K"; 11static inline void cursor_line(unsigned n) { printf("\x1b[%uH", n + 1); } 12static inline void cursor_column(unsigned n) { printf("\x1b[%uG", n + 1); } 13static char const show_cursor[] = "\x1b[?25h", hide_cursor[] = "\x1b[?25l"; 14static char const color_black[] = "\x1b[30m"; 15static char const color_red[] = "\x1b[31m"; 16static char const color_green[] = "\x1b[32m"; 17static char const color_yellow[] = "\x1b[33m"; 18static char const color_blue[] = "\x1b[34m"; 19static char const color_purple[] = "\x1b[35m"; 20static char const color_cyan[] = "\x1b[36m"; 21static char const color_white[] = "\x1b[37m"; 22static char const color_normal[] = "\x1b[39m"; 23 24static char const enter_alternate_screen[] = "\x1b[?1049h\x1b[0;0H"; 25static char const leave_alternate_screen[] = "\x1b[?1049l"; 26 27#endif