I'm doing a word search, and the words that the user has found I wanted to mark in color, but I only get the printed string code and not the color. I have created a separate class to test if the colors work, but there is no way. How can I print colors?
public class color {
public static void main(String[] args) {
String black="\033[30m";
String red="\033[31m";
String green="\033[32m";
String yellow="\033[33m";
String blue="\033[34m";
String purple="\033[35m";
String cyan="\033[36m";
String white="\033[37m";
String reset="\u001B[0m";
System.out.println ();
System.out.println (red + "Text string in red" + reset);
System.out.println (green + "Text string in green" + reset);
System.out.println (yellow + "Text string in yellow" + reset);
System.out.println (white + "Text string in white" + reset);
System.out.println (black + "Black text string" + reset + "(<- black text string that cannot be seen because my background is black)" + reset);
System.out.println (blue + "Text string in blue" + reset);
System.out.println (purple + "Magenta string" + reset);
System.out.println (cyan + "Text string in cyan" + reset);
System.out.println (reset + "Default color string" + reset);
System.out.println ();
}
}