xref: /openbmc/linux/tools/perf/util/color.h (revision 86470930)
186470930SIngo Molnar #ifndef COLOR_H
286470930SIngo Molnar #define COLOR_H
386470930SIngo Molnar 
486470930SIngo Molnar /* "\033[1;38;5;2xx;48;5;2xxm\0" is 23 bytes */
586470930SIngo Molnar #define COLOR_MAXLEN 24
686470930SIngo Molnar 
786470930SIngo Molnar #define PERF_COLOR_NORMAL	""
886470930SIngo Molnar #define PERF_COLOR_RESET	"\033[m"
986470930SIngo Molnar #define PERF_COLOR_BOLD		"\033[1m"
1086470930SIngo Molnar #define PERF_COLOR_RED		"\033[31m"
1186470930SIngo Molnar #define PERF_COLOR_GREEN	"\033[32m"
1286470930SIngo Molnar #define PERF_COLOR_YELLOW	"\033[33m"
1386470930SIngo Molnar #define PERF_COLOR_BLUE		"\033[34m"
1486470930SIngo Molnar #define PERF_COLOR_MAGENTA	"\033[35m"
1586470930SIngo Molnar #define PERF_COLOR_CYAN		"\033[36m"
1686470930SIngo Molnar #define PERF_COLOR_BG_RED	"\033[41m"
1786470930SIngo Molnar 
1886470930SIngo Molnar /*
1986470930SIngo Molnar  * This variable stores the value of color.ui
2086470930SIngo Molnar  */
2186470930SIngo Molnar extern int perf_use_color_default;
2286470930SIngo Molnar 
2386470930SIngo Molnar 
2486470930SIngo Molnar /*
2586470930SIngo Molnar  * Use this instead of perf_default_config if you need the value of color.ui.
2686470930SIngo Molnar  */
2786470930SIngo Molnar int perf_color_default_config(const char *var, const char *value, void *cb);
2886470930SIngo Molnar 
2986470930SIngo Molnar int perf_config_colorbool(const char *var, const char *value, int stdout_is_tty);
3086470930SIngo Molnar void color_parse(const char *value, const char *var, char *dst);
3186470930SIngo Molnar void color_parse_mem(const char *value, int len, const char *var, char *dst);
3286470930SIngo Molnar int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
3386470930SIngo Molnar int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
3486470930SIngo Molnar int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
3586470930SIngo Molnar 
3686470930SIngo Molnar #endif /* COLOR_H */
37