Colour your Console (now in Java)

Most of us have seen how Rails uses colour in its server log, to highlight important lines or even words as the log scrolls by. In case you haven’t, below is a screenshot:
rails-color-1.png
Java Devs, its now time for you too to keep your consoles pretty. Here is a very simple Color.java class that will wrap any text with the appropriate ANSI color codes.
From the javadoc:

This class uses the Builder Pattern, to allow combining formats.
e.g. for a blue background and a bold, white foreground you would use:
new Color(“some important message”).b().white().bg().blue();

The latest version of the Atlassian SDK, already ships with an ‘atlas-clover‘ command to run your plugin’s tests with Clover Coverage enabled. If you’ve set the MAVEN_COLOR=true system variable, there is now no reason to switch out to the HTML report for that red/green satisfaction. Clover logs the coverage bars to the console like so:
color-clover.png
More on ANSI Color for Java can be found on the wiki.
Oh – and if you are using Clover with either Ant or Maven2 – you can get the same goodness by setting the system variable: -Dansi.color=true.

Published

in

Related Content

More in ‘

Warning: Undefined array key “link” in /srv/users/atlassian/apps/atlassianstaging/public/wp-content/plugins/curator/template-parts/cards/article-card.php on line 119
Company News
Announcing social enterprise discounts: Atlassian tools for social impact teams

Warning: Undefined array key “link” in /srv/users/atlassian/apps/atlassianstaging/public/wp-content/plugins/curator/template-parts/cards/article-card.php on line 119
Leadership
Great managers meet uncertainty with curiosity and confidence

Warning: Undefined array key “link” in /srv/users/atlassian/apps/atlassianstaging/public/wp-content/plugins/curator/template-parts/cards/article-card.php on line 119
Company News
Introducing Databricks Query Runner: Transforming data into insight

Warning: Undefined array key “link” in /srv/users/atlassian/apps/atlassianstaging/public/wp-content/plugins/curator/template-parts/cards/article-card.php on line 119
Company News
Team ’25 Europe: AI that’s changing the game for teams

More Collections


Warning: Undefined array key “link” in /srv/users/atlassian/apps/atlassianstaging/public/wp-content/plugins/curator/template-parts/cards/article-card.php on line 119

Meet Rovo everywhere: AI that connects every app, every team, every workflow


Warning: Undefined array key “link” in /srv/users/atlassian/apps/atlassianstaging/public/wp-content/plugins/curator/template-parts/cards/article-card.php on line 119

Introducing Atlassian Software Collection


Warning: Undefined array key “link” in /srv/users/atlassian/apps/atlassianstaging/public/wp-content/plugins/curator/template-parts/cards/article-card.php on line 119

Move Faster and Work Smarter with Atlassian’s AI-Powered Teamwork Collection