I am creating a Java program that uses menus with different colors using ANSI escape codes. Sort of
System.out.println("\u001B[36m"+"Menu option"+"\u001B[0m");
The problem is that I want to check if the console supports where the code will be executed using these codes, so if this is not the case, print an alternative version without codes.
It will be something similar to:
if(console.supportsANSICode){
System.out.println("\u001B[36m"+"Menu option"+"\u001B[0m");
}
else{
System.out.println("Menu option");
}
Is there a way in java to verify this?
source
share