如何为 System.out.println 输出着色? [英] How to color System.out.println output?

查看:36
本文介绍了如何为 System.out.println 输出着色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为 Java 输出着色?

How can I color Java output?

例如在 C 和其他语言中,我可以使用 ANSI-escape 像 33[0m 来做到这一点.但在 Java 中它不起作用.

For example in C and other languages I can use ANSI-escape like 33[0m to do this. But in Java it doesn't work.

public static void main(String[] x) {
    System.out.println("33[0m BLABLA 33[0m
");
}

推荐答案

没有,但是有第三方 API 可以处理它

No, but there are third party API's that can handle it

http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html

当然还有比我发布的文章更新的文章,但信息仍然可用.

of course there are newer articles than that one I posted, the information is still viable though.

以上链接已失效,请参阅此问题:如何使用 System.out.println 在控制台中打印颜色?

Above link is dead, see this question instead: How to print color in console using System.out.println?

这篇关于如何为 System.out.println 输出着色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆