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

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

问题描述

问题很简单:

如何着色java输出?

How can I color java output?

例如在C和其他语言中,我可以像\033 [0m)一样使用ansi-escape来做到这一点。但在java中它不工作。

For example in C and other languages I can use ansi-escape like \033[0m to do this. But in java it doesn't work.

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


推荐答案

可以处理它的第API 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输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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