Changing the color of text in the console - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Changing the color of text in the console

EsranEsran Posts: 4Member
I have a little problem. I'm making a console application, but would like to add some color to it. I know that it's possible, but for some reason the color of the text produced in the console by Java always defaults to light gray. Is there some way to change this color? There must be a command to do it.

For example, I want to write a Java program that produces the same output as this C++ program:

#include
#include
#include
using namespace std;

int main()
{
textcolor(GREEN);
cout << "Hi" << endl;
textcolor(LIGHTMAGENTA);
cout << "Bye" << endl;
textcolor(LIGHTGRAY);
system("PAUSE");
return 0;
}

Does anyone know how to accomplish this? If you do, please let me know.

Thanks!!!
Sign In or Register to comment.