首页 > 系统相关 >LINUX颜色打印

LINUX颜色打印

时间:2024-03-29 12:14:16浏览次数:18  
标签:__ VA ARGS 颜色 LINUX 打印 printfy printf define

 

/////////////////////////////////////////////////////////////////////////////////////
#define D_RED              "\e[0;31m"//
#define RED                "\e[1;31m"//红
#define D_GREEN            "\e[0;32m"//
#define GREEN              "\e[1;32m"//绿
#define D_BLUE             "\e[0;34m"//
#define BLUE               "\e[1;34m"//蓝
#define D_YELLOW           "\e[0;33m"//
#define YELLOW             "\e[1;33m"//黄
#define D_CYAN             "\e[0;36m"//
#define CYAN               "\e[1;36m"//青
#define D_PURPLE           "\e[0;35m"//
#define PURPLE             "\e[1;35m"//紫

#define D_BLACK            "\e[0;30m"//
#define BLACK              "\e[1;30m"//黑
#define D_WHITE            "\e[0;37m"//暗白(灰)
#define WHITE              "\e[1;37m"//白
 
#define NONE               "\e[0m"
#define BOLD               "\e[1m"   //
#define CLEAR              "\e[2J"   //
#define UNDERLINE          "\e[4m"   //
#define BLINK              "\e[5m"   //
#define REVERSE            "\e[7m"   //
#define HIDE               "\e[8m"   //
#define CLRLINE            "\r\e[K"  //卷曲
////////////////////////////////////////////////////////////////////////////////////////////
//                                                                             颜色 字符串 属性, 换行 
#define printfdr(x,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(D_RED    x NONE, ##__VA_ARGS__)) 
#define printfr(x ,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(RED      x NONE, ##__VA_ARGS__)) 
#define printfdg(x,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(D_GREEN  x NONE, ##__VA_ARGS__)) 
#define printfg(x ,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(GREEN    x NONE, ##__VA_ARGS__)) 
#define printfdb(x,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(D_BLUE   x NONE, ##__VA_ARGS__)) 
#define printfb(x ,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(BLUE     x NONE, ##__VA_ARGS__)) 
#define printfbr(x,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(D_YELLOW x NONE, ##__VA_ARGS__)) 
#define printfy(x ,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(YELLOW   x NONE, ##__VA_ARGS__)) 
#define printfdc(x,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(D_CYAN   x NONE, ##__VA_ARGS__)) 
#define printfc(x ,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(CYAN     x NONE, ##__VA_ARGS__)) 
#define printfdp(x,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(D_PURPLE x NONE, ##__VA_ARGS__)) 
#define printfp(x ,...)    (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(PURPLE   x NONE, ##__VA_ARGS__)) 

#define printfdbl(x,...)   (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(D_BLACK x NONE, ##__VA_ARGS__)) 
#define printfbl(x ,...)   (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(BLACK   x NONE, ##__VA_ARGS__)) 
#define printfdw(x ,...)   (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(D_WHITE x NONE, ##__VA_ARGS__)) 
#define printfw(x  ,...)   (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(WHITE   x NONE, ##__VA_ARGS__)) 

#define printfy_bo(x ,...)  (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(YELLOW   x BOLD,      ##__VA_ARGS__)) 
#define printfy_cl(x ,...)  (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(YELLOW   x CLEAR,     ##__VA_ARGS__)) 
#define printfy_un(x ,...)  (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(YELLOW   x UNDERLINE, ##__VA_ARGS__)) 
#define printfy_bl(x ,...)  (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(YELLOW   x BLINK,     ##__VA_ARGS__)) 
#define printfy_rv(x ,...)  (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(YELLOW   x REVERSE,   ##__VA_ARGS__)) 
#define printfy_hd(x ,...)  (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(YELLOW   x HIDE,      ##__VA_ARGS__)) 
#define printfy_cll(x,...)  (printf("msg:L%d-%s:",__LINE__,__FUNCTION__),printf(YELLOW   x CLRLINE,   ##__VA_ARGS__)) 
/*
        printfdr("printfr ////////////////////////////////////////////////////////////");
        printfr ("printflr////////////////////////////////////////////////////////////");
        printfdg("printfg ////////////////////////////////////////////////////////////");
        printfg ("printflg////////////////////////////////////////////////////////////");
        printfdb("printfb ////////////////////////////////////////////////////////////");
        printfb ("printflb////////////////////////////////////////////////////////////");
        printfbr("printfbr////////////////////////////////////////////////////////////");
        printfy ("printfy ////////////////////////////////////////////////////////////");
        printfdc("printft ////////////////////////////////////////////////////////////");
        printfc ("printflt////////////////////////////////////////////////////////////");
        printfdp("printfp ////////////////////////////////////////////////////////////");
        printfp ("printflp////////////////////////////////////////////////////////////");

        printfdbl("printflp////////////////////////////////////////////////////////////");
        printfbl ("printflp////////////////////////////////////////////////////////////");
        printfdw ("printflp////////////////////////////////////////////////////////////");
        printfw  ("printflp////////////////////////////////////////////////////////////");

        printfy_bo("printfy_bo////////////////////////////////////////////////////////////");
        printfy_cl("printfy_cl////////////////////////////////////////////////////////////");
        printfy_un("printfy_un////////////////////////////////////////////////////////////");
        printfy_bl("printfy_bl////////////////////////////////////////////////////////////");
        printfy_rv("printfy_rv////////////////////////////////////////////////////////////");
        printfy_hd("printfy_hd////////////////////////////////////////////////////////////");
        printfy_cll("printfy_cll////////////////////////////////////////////////////////////");
*/
////////////////////////////////////////////////////////////////////////////////////////////

 

标签:__,VA,ARGS,颜色,LINUX,打印,printfy,printf,define
From: https://www.cnblogs.com/xuweihui/p/18103527

相关文章

  • Linux安装Mysql
    一、下载 https://downloads.mysql.com/archives/community/ 二、创建用户groupaddmysqluseradd-gmysqlmysql三、安装1、解压 tar-xvfmysql-8.0.28-el7-x86_64.tar.gz2、重新命名mvmysql-8.0.28-el7-x86_64.tar.gzmysql-8.0.283、加入配置root下......
  • 使用三个线程交替打印ABC
    //用的是线程、互斥锁、条件变量#include<iostream>#include<thread>#include<mutex>#include<condition_variable>usingnamespacestd;mutex_mutex; //定义锁变量condition_variablecv; //定义条件变量intflag=0; //切换线程的标识符,flag:0-2分别对应A......
  • Linux 上用 docker-compose 文件指定的方式安装ETCD
    转载自:https://xie.infoq.cn/article/ffb0703096f0de1045e1ab028,这篇博客很棒!完全可执行的。本人修改了作者docker命令替换成了dockercompose文件的方式。创建数据保存目录:mkdir-p/home/service/etcd/data;创建配置目录:/home/service/etcd/conf;配置文件:/home/service......
  • 转载:使用 Linux tracepoint、perf 和 eBPF 跟踪数据包 (2017)
    http://arthurchiao.art/blog/trace-packet-with-tracepoint-perf-ebpf-zh/Linux允许在主机上用虚拟网卡(virtualinterface)和网络命名空间(networknamespace)构建复杂的网络。但出现故障时,排障(troubleshooting)相当痛苦。如果是3层路由问题,mtr 可以排上用场;但如果是更底层的问......
  • Linux下TCP/IP编程--TCP实战
    之前尝试过windows下的简单TCP客户端服务器编写,这次尝试下一下Linux环境下的TCP客户端代码#include<stdio.h>#include<stdlib.h>#include<string.h>#include<unistd.h>#include<sys/socket.h>#include<netinet/in.h>#include<arpa/inet.h>structC......
  • c语言例题,逐个打印数字
    今天来分享个比较简单的程序例题,也是比较经典的一个新手例题,逐个打印输入的数字。我们直接从主函数看起,先定义一个num变量,同时变量的类型是unsignedint,这个类型的意思是无符号的整型变量,unsigned(无符号)是用来修饰int的,说明了num这个变量只能是正数,然后我们用scanf输入想要的数......
  • linux文件相关命令 通过文件获取父文件夹名称
    linux文件相关命令通过文件获取父文件夹名称不说废话,先上命令通过文件获取父文件夹名称dirname$(realpath`your_filename`)通过文件路径得到文件名称basename`your_filename`相关命令basenamedirnamerealpathreallinklspwd通过文件获取父文件夹名称......
  • python 去除图片中指定颜色框或线
    目录Python去除图片中指定颜色框或线思路和步骤代码实现示例代码主要特点:一些常用功能:与OpenCV的区别:结语Python去除图片中指定颜色框或线在图像处理中,有时候我们需要对图片进行一些特定颜色框或线的处理,例如去除指定颜色的框或线。Python提供了强大的图像处理库Op......
  • 在Linux中,如何创建和管理KVM虚拟机?
    在Linux环境中创建和管理KVM(Kernel-basedVirtualMachine)虚拟机通常涉及以下几个步骤:1.系统准备与检查确保系统兼容性:检查CPU是否支持硬件虚拟化(如IntelVT-x或AMD-V)。可以使用以下命令:egrep-o'(vmx|svm)'/proc/cpuinfo如果返回结果中有vmx(Intel)或svm(AMD),则说明CPU支......
  • 在Linux中,如何追踪TCP连接和网络数据包,如使用tcpdump或Wireshark?
    在Linux环境中,追踪TCP连接和网络数据包主要通过使用命令行工具tcpdump和图形化网络分析软件Wireshark来实现。以下是详细的操作步骤:1.使用tcpdumptcpdump是一个强大的命令行网络抓包工具,用于实时捕获和分析网络流量。以下是如何使用tcpdump追踪TCP连接和数据包:1.基本用法......