-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbravo_six.ts
46 lines (40 loc) · 1.17 KB
/
bravo_six.ts
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
class Bravo_Six {
private targetElement: HTMLElement;
constructor(targetElement?: HTMLElement) {
this.targetElement = targetElement || document.body;
}
getOriginalStyles(): { backgroundColor: string; color: string } {
return {
backgroundColor: this.targetElement.style.backgroundColor,
color: this.targetElement.style.color,
};
}
applyColors(colorTheme: string): void {
console.log("Applying color theme:", colorTheme);
let backgroundColor, textColor;
switch (colorTheme) {
case "original":
backgroundColor = ""; // Kosongkan nilai untuk kembali ke nilai CSS awal
textColor = "";
break;
case "dark":
backgroundColor = "black";
textColor = "white";
break;
case "light":
backgroundColor = "white";
textColor = "black";
break;
case "night-vision":
backgroundColor = "#367978";
textColor = "white";
break;
default:
console.error("Invalid color theme");
return;
}
this.targetElement.style.backgroundColor = backgroundColor;
this.targetElement.style.color = textColor;
}
}
export { Bravo_Six };