1public class ConsoleColors {
2 // Reset
3 public static final String RESET = "\033[0m"; // Text Reset
4
5 // Regular Colors
6 public static final String BLACK = "\033[0;30m"; // BLACK
7 public static final String RED = "\033[0;31m"; // RED
8 public static final String GREEN = "\033[0;32m"; // GREEN
9 public static final String YELLOW = "\033[0;33m"; // YELLOW
10 public static final String BLUE = "\033[0;34m"; // BLUE
11 public static final String PURPLE = "\033[0;35m"; // PURPLE
12 public static final String CYAN = "\033[0;36m"; // CYAN
13 public static final String WHITE = "\033[0;37m"; // WHITE
14
15 // Bold
16 public static final String BLACK_BOLD = "\033[1;30m"; // BLACK
17 public static final String RED_BOLD = "\033[1;31m"; // RED
18 public static final String GREEN_BOLD = "\033[1;32m"; // GREEN
19 public static final String YELLOW_BOLD = "\033[1;33m"; // YELLOW
20 public static final String BLUE_BOLD = "\033[1;34m"; // BLUE
21 public static final String PURPLE_BOLD = "\033[1;35m"; // PURPLE
22 public static final String CYAN_BOLD = "\033[1;36m"; // CYAN
23 public static final String WHITE_BOLD = "\033[1;37m"; // WHITE
24
25 // Underline
26 public static final String BLACK_UNDERLINED = "\033[4;30m"; // BLACK
27 public static final String RED_UNDERLINED = "\033[4;31m"; // RED
28 public static final String GREEN_UNDERLINED = "\033[4;32m"; // GREEN
29 public static final String YELLOW_UNDERLINED = "\033[4;33m"; // YELLOW
30 public static final String BLUE_UNDERLINED = "\033[4;34m"; // BLUE
31 public static final String PURPLE_UNDERLINED = "\033[4;35m"; // PURPLE
32 public static final String CYAN_UNDERLINED = "\033[4;36m"; // CYAN
33 public static final String WHITE_UNDERLINED = "\033[4;37m"; // WHITE
34
35 // Background
36 public static final String BLACK_BACKGROUND = "\033[40m"; // BLACK
37 public static final String RED_BACKGROUND = "\033[41m"; // RED
38 public static final String GREEN_BACKGROUND = "\033[42m"; // GREEN
39 public static final String YELLOW_BACKGROUND = "\033[43m"; // YELLOW
40 public static final String BLUE_BACKGROUND = "\033[44m"; // BLUE
41 public static final String PURPLE_BACKGROUND = "\033[45m"; // PURPLE
42 public static final String CYAN_BACKGROUND = "\033[46m"; // CYAN
43 public static final String WHITE_BACKGROUND = "\033[47m"; // WHITE
44
45 // High Intensity
46 public static final String BLACK_BRIGHT = "\033[0;90m"; // BLACK
47 public static final String RED_BRIGHT = "\033[0;91m"; // RED
48 public static final String GREEN_BRIGHT = "\033[0;92m"; // GREEN
49 public static final String YELLOW_BRIGHT = "\033[0;93m"; // YELLOW
50 public static final String BLUE_BRIGHT = "\033[0;94m"; // BLUE
51 public static final String PURPLE_BRIGHT = "\033[0;95m"; // PURPLE
52 public static final String CYAN_BRIGHT = "\033[0;96m"; // CYAN
53 public static final String WHITE_BRIGHT = "\033[0;97m"; // WHITE
54
55 // Bold High Intensity
56 public static final String BLACK_BOLD_BRIGHT = "\033[1;90m"; // BLACK
57 public static final String RED_BOLD_BRIGHT = "\033[1;91m"; // RED
58 public static final String GREEN_BOLD_BRIGHT = "\033[1;92m"; // GREEN
59 public static final String YELLOW_BOLD_BRIGHT = "\033[1;93m";// YELLOW
60 public static final String BLUE_BOLD_BRIGHT = "\033[1;94m"; // BLUE
61 public static final String PURPLE_BOLD_BRIGHT = "\033[1;95m";// PURPLE
62 public static final String CYAN_BOLD_BRIGHT = "\033[1;96m"; // CYAN
63 public static final String WHITE_BOLD_BRIGHT = "\033[1;97m"; // WHITE
64
65 // High Intensity backgrounds
66 public static final String BLACK_BACKGROUND_BRIGHT = "\033[0;100m";// BLACK
67 public static final String RED_BACKGROUND_BRIGHT = "\033[0;101m";// RED
68 public static final String GREEN_BACKGROUND_BRIGHT = "\033[0;102m";// GREEN
69 public static final String YELLOW_BACKGROUND_BRIGHT = "\033[0;103m";// YELLOW
70 public static final String BLUE_BACKGROUND_BRIGHT = "\033[0;104m";// BLUE
71 public static final String PURPLE_BACKGROUND_BRIGHT = "\033[0;105m"; // PURPLE
72 public static final String CYAN_BACKGROUND_BRIGHT = "\033[0;106m"; // CYAN
73 public static final String WHITE_BACKGROUND_BRIGHT = "\033[0;107m"; // WHITE
74}
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";