-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtility.java
More file actions
48 lines (38 loc) · 1.48 KB
/
Copy pathUtility.java
File metadata and controls
48 lines (38 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
public class Utility{
public static void color(String str){
str = str.toLowerCase();
if(str.equals("red"))getColorCode(1);
else if(str.equals("black"))getColorCode(0);
else if(str.equals(("green")))getColorCode(2);
else if(str.equals("yellow"))getColorCode(3);
else if(str.equals("blue"))getColorCode(4);
else if(str.equals("magneta"))getColorCode(5);
else if(str.equals("cyan"))getColorCode(6);
else if(str.equals("white"))getColorCode(7);
else getColorCode(8);
}
public static void getColorCode(int index){
/**
* Color codes are as follows :-
*
Black: \u001b[30m
Red: \u001b[31m
Green: \u001b[32m
Yellow: \u001b[33m
Blue: \u001b[34m
Magenta: \u001b[35m
Cyan: \u001b[36m
White: \u001b[37m
Reset: \u001b[0m
*/
if(index == 0)System.out.println("\u001b[30m");
else if(index == 1)System.out.println("\u001b[31m");
else if(index == 2)System.out.println("\u001b[32m");
else if(index == 3)System.out.println("\u001b[33m");
else if(index == 4)System.out.println("\u001b[34m");
else if(index == 5)System.out.println("\u001b[35m");
else if(index == 6)System.out.println("\u001b[36m");
else if(index == 7)System.out.println("\u001b[37m");
else if(index == 8)System.out.println("\u001b[0m");
}
}