I was wondering if in that location is someway for me to set the color of the text that I output to the console in Coffee. Information technology does not matter if information technology is organisation specific equally the program volition only be run on my Windows 7 x64 laptop.

This question: Change color in java eclipse console was asked several weeks agone and had a skilful solution(by @VonC) to a like trouble however it only addressed the issue inside eclipse.

Can the same effect be accomplished if I execute my program from the command line? and if so how?

asked May 7 2011 at 19:20

one

4 Answers iv

answered May vii 2011 at xix:24

0

thy this.... furthermore read http://jansi.fusesource.org/

                  public static final String ANSI_RESET = "\u001B[0m"; public static final String ANSI_BLACK = "\u001B[30m"; public static concluding String ANSI_RED = "\u001B[31m"; public static concluding Cord ANSI_GREEN = "\u001B[32m"; public static last String ANSI_YELLOW = "\u001B[33m"; public static final Cord ANSI_BLUE = "\u001B[34m"; public static terminal String ANSI_PURPLE = "\u001B[35m"; public static final String ANSI_CYAN = "\u001B[36m"; public static final String ANSI_WHITE = "\u001B[37m";                                  

answered Aug 28 2014 at 11:16

1

  • Don't forget to add usage: System.out.println( " This volition be purple: " + Majestic + "Purple!" + RESET + " normal color text" );

    Dec 12 2014 at five:25

Another library you may be interested in is Jansi: http://jansi.fusesource.org/

Jansi interprets ANSI code and format them for the panel output. It works for both unix and windows.

Update 11/2014: y'all can also come across the github Page

answered May 7 2011 at 20:33

Not directly related to Java console output, but if you're looking to use ANSI colors in Kotlin console output, this is a smashing library to use - https://github.com/importre/crayon

answered Jul three 2018 at 23:54

1

  • Ha - Kotlin hadn't been released yet when I asked this question! It would be announced 2 months later and I wouldn't actually learn of information technology until several years later.

    Aug xi 2018 at 21:03

Not the answer you're looking for? Browse other questions tagged java colors formatting console or ask your own question.