#define NONE "\033[m" //正常终端颜色
#define RED "\033[0;32;31m"
#define LIGHT_RED "\033[1;31m"
#define GREEN "\033[0;32;32m"
#define LIGHT_GREEN "\033[1;32m"
#define BLUE "\033[0;32;34m"
#define LIGHT_BLUE "\033[1;34m"
#define CYAN "\033[0;36m"
#define LIGHT_CYAN "\033[1;36m"
#define PURPLE "\033[0;35m"
#define LIGHT_PURPLE "\033[1;35m"
#define YELLOW "\033[1;33m"
#define WHITE "\033[1;37m" //粗体白色
#define DARY_GRAY "\033[1;30m" //暗灰色
用法:
printf(LIGHT_RED "this is a debug sentence.\n" NONE);
printf("this is normal output.\n");
效果:
说明:
windows cmd不支持,但其他终端工具,如gitbash和vscode自带终端都支持