I have a Java program, which emits ANSI escape sequences to generate colored output in a terminal. This works on Linux out of the box and it works on Windows, if the program gets executed in ConEmu. Now I would like to find out, if the environment is capable to display ANSI colors. On Linux I can check the TERM
variable with System.getenv("TERM")
. But on Windows how to find out in Java, if the program runs in a ConEmu terminal?
Checking System.getenv("ANSICON")
seems to be fine.