我的SCRT顏色設定

败人两字非傲即惰發表於2024-04-20
//include_lib\system\debug.h
/*
 *  LOG 透過常量控制
 */
#elif (LOG_MODE == LOG_BY_CONST)

#define log_info(format, ...)       \
    if (LOG_IS_ENABLE(LOG_INFO)) \
        printf("\e[1;47;35m" "[%s %d]:" "log_info(format, ...)" "\e[0m",__FUNCTION__,__LINE__);log_print(__LOG_INFO,NULL,"[Info]: " _LOG_TAG format "\r\n", ## __VA_ARGS__)


//apps\hid\include\app_config.h
/*********************************************************************************/
//字色 亮色 常用色(亮色;灰底)
#define RED                "\e[1;47;31m"//
#define GREEN              "\e[1;47;32m"//
#define BLUE               "\e[1;47;34m"//
#define YELLOW             "\e[1;47;33m"//
#define CYAN               "\e[1;47;36m"//
#define PURPLE             "\e[1;47;35m"//
#define BLACK              "\e[1;47;30m"//
#define WHITE              "\e[1;47;37m"//
//字色 暗色
#define D_RED              "\e[0;31m"//暗紅
#define D_GREEN            "\e[0;32m"//
#define D_BLUE             "\e[0;34m"//
#define D_YELLOW           "\e[0;33m"//
#define D_CYAN             "\e[0;36m"//
#define D_PURPLE           "\e[0;35m"//
#define D_BLACK            "\e[0;30m"//
#define D_WHITE            "\e[0;37m"//暗白(灰)
//底色
#define BG_RED             "\e[1;41m"
#define BG_GREEN           "\e[1;42m"
#define BG_BLUE            "\e[1;44m"
#define BG_YELLOW          "\e[1;43m"
#define BG_CYAN            "\e[1;46m"
#define BG_PURPLE          "\e[1;45m"
#define BG_WHITE           "\e[1;47m"
#define BG_GREEN2          "\e[1;48m"

 //強調
#define END_ATTR           "\e[0m"
#define BOLD               "\e[1m"   //
#define UNDERLINE          "\e[4m"   //
#define BLINK              "\e[5m"   //
#define REVERSE            "\e[7m"   //
#define HIDE               "\e[8m"   //
#define CLEAR              "\e[2J"   //清理
#define CLRLINE            "\r\e[K"  //捲曲
/*********************************************************************************/
//                                  顏色                                                                字串 強調    結束屬性, 換行 
#define printfr(x    ,...)  (printf(RED      "[%s %d]:" x           END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfg(x    ,...)  (printf(GREEN    "[%s %d]:" x           END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfb(x    ,...)  (printf(BLUE     "[%s %d]:" x           END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfy(x    ,...)  (printf(YELLOW   "[%s %d]:" x           END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfc(x    ,...)  (printf(CYAN     "[%s %d]:" x           END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfp(x    ,...)  (printf(PURPLE   "[%s %d]:" x           END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfbl(x   ,...)  (printf(BLACK    "[%s %d]:" x           END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfw(x    ,...)  (printf(WHITE    "[%s %d]:" x           END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfg_bo(x ,...)  (printf(GREEN    "[%s %d]:" x BOLD      END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfg_un(x ,...)  (printf(GREEN    "[%s %d]:" x UNDERLINE END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfg_bl(x ,...)  (printf(GREEN    "[%s %d]:" x BLINK     END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
#define printfg_rv(x ,...)  (printf(GREEN    "[%s %d]:" x REVERSE   END_ATTR,__FUNCTION__,__LINE__,##__VA_ARGS__)) 
/*********************************************************************************/

設定

效果圖

相關文章