1// Define color constants
2public static final String TEXT_RESET = "\u001B[0m";
3public static final String TEXT_BLACK = "\u001B[30m";
4public static final String TEXT_RED = "\u001B[31m";
5public static final String TEXT_GREEN = "\u001B[32m";
6public static final String TEXT_YELLOW = "\u001B[33m";
7public static final String TEXT_BLUE = "\u001B[34m";
8public static final String TEXT_PURPLE = "\u001B[35m";
9public static final String TEXT_CYAN = "\u001B[36m";
10public static final String TEXT_WHITE = "\u001B[37m";
11
12// Implementation
13System.out.println(TEXT_RED + "This text is red!" + TEXT_RESET);
1public static final String ANSI_BLACK_BACKGROUND = "\u001B[40m";
2public static final String ANSI_RED_BACKGROUND = "\u001B[41m";
3public static final String ANSI_GREEN_BACKGROUND = "\u001B[42m";
4public static final String ANSI_YELLOW_BACKGROUND = "\u001B[43m";
5public static final String ANSI_BLUE_BACKGROUND = "\u001B[44m";
6public static final String ANSI_PURPLE_BACKGROUND = "\u001B[45m";
7public static final String ANSI_CYAN_BACKGROUND = "\u001B[46m";
8public static final String ANSI_WHITE_BACKGROUND = "\u001B[47m";