java如何设置控制台打印的字体颜色、背景、字体样式(idea设置打印字体样式)工具类 - 附插件方式

效果:
在这里插入图片描述

设置控制台打印字体颜色、背景、字体样式,java工具类

package org.dxl.log;

import java.util.Arrays;

/**
 *  在控制台按照传入格式输出 
 *
 * @author IT_CREAT
 * @date 2021 2021/1/17/017 4:49  
 */
public class ColorPrint {
   
   
    /**
     * 分号
     */
    private static final String SEMICOLON = ";";

    /**
     * 默认黑色打印
     *
     * @param txt 信息
     */
    public static void outPrintln(String txt) {
   
   
        System.out.println(format(txt, PrintCode.BLACK));
    }

    /**
     * 换行打印
     *
     * @param txt   信息
     * @param codes 格式化参数
     */
    public static void outPrintln(String txt, PrintCode... codes) {
   
   
        System.out.println(format(txt, codes));
    }

    /**
     * 不换行打印
     *
     * @param txt   打印内容
     * @param codes 格式化参数
     */
    public static void outPrint(String txt, PrintCode... codes) {
   
   
        System.out.print(format(txt, codes));
    }

    /**
     * 默认红色打印
     *
     * @param txt 信息
     */
    public static void errorPrintln(String txt) {
   
   
        System.err.println(format(txt, PrintCode.RED));
    }

    /**
     * 换行打印
     *
     * @param txt   信息
     * @param codes 格式化参数
     */
    public static void errorPrintln(String txt, PrintCode... codes) {
   
   
        System.err.println(format(txt, codes))
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值