2009-09-24 20:02:18 +04:00
# ifndef __PERF_COLOR_H
# define __PERF_COLOR_H
2009-06-04 17:19:47 +04:00
2017-04-20 02:57:47 +03:00
# include <stdio.h>
2009-06-04 17:19:47 +04:00
/* "\033[1;38;5;2xx;48;5;2xxm\0" is 23 bytes */
# define COLOR_MAXLEN 24
# define PERF_COLOR_NORMAL ""
# define PERF_COLOR_RESET "\033[m"
# define PERF_COLOR_BOLD "\033[1m"
# define PERF_COLOR_RED "\033[31m"
# define PERF_COLOR_GREEN "\033[32m"
# define PERF_COLOR_YELLOW "\033[33m"
# define PERF_COLOR_BLUE "\033[34m"
# define PERF_COLOR_MAGENTA "\033[35m"
# define PERF_COLOR_CYAN "\033[36m"
# define PERF_COLOR_BG_RED "\033[41m"
2009-07-02 22:14:34 +04:00
# define MIN_GREEN 0.5
# define MIN_RED 5.0
2009-06-04 17:19:47 +04:00
/*
* This variable stores the value of color . ui
*/
extern int perf_use_color_default ;
/*
* Use this instead of perf_default_config if you need the value of color . ui .
*/
int perf_color_default_config ( const char * var , const char * value , void * cb ) ;
int perf_config_colorbool ( const char * var , const char * value , int stdout_is_tty ) ;
2010-03-31 18:33:40 +04:00
int color_vsnprintf ( char * bf , size_t size , const char * color ,
const char * fmt , va_list args ) ;
2009-08-17 00:05:48 +04:00
int color_vfprintf ( FILE * fp , const char * color , const char * fmt , va_list args ) ;
2009-06-04 17:19:47 +04:00
int color_fprintf ( FILE * fp , const char * color , const char * fmt , . . . ) ;
2010-03-31 18:33:40 +04:00
int color_snprintf ( char * bf , size_t size , const char * color , const char * fmt , . . . ) ;
2009-06-04 17:19:47 +04:00
int color_fwrite_lines ( FILE * fp , const char * color , size_t count , const char * buf ) ;
2013-12-30 11:34:20 +04:00
int value_color_snprintf ( char * bf , size_t size , const char * fmt , double value ) ;
2013-11-01 03:47:45 +04:00
int percent_color_snprintf ( char * bf , size_t size , const char * fmt , . . . ) ;
2014-07-31 09:47:36 +04:00
int percent_color_len_snprintf ( char * bf , size_t size , const char * fmt , . . . ) ;
2009-07-02 22:14:34 +04:00
int percent_color_fprintf ( FILE * fp , const char * fmt , double percent ) ;
2009-08-15 14:26:57 +04:00
const char * get_percent_color ( double percent ) ;
2009-06-04 17:19:47 +04:00
2009-09-24 20:02:18 +04:00
# endif /* __PERF_COLOR_H */