-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathnetzgrafikColor.model.ts
112 lines (96 loc) · 2.68 KB
/
netzgrafikColor.model.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import {NetzgrafikColorDto} from "../data-structures/business.data.structures";
import {ColorRefType} from "../data-structures/technical.data.structures";
export class NetzgrafikColor {
private static currentId = 0;
private id: number;
private colorRef: ColorRefType;
private color: string;
private colorFocus: string;
private colorMuted: string;
private colorRelated: string;
private colorDarkMode: string;
private colorDarkModeFocus: string;
private colorDarkModeMuted: string;
private colorDarkModeRelated: string;
constructor(
{
id,
colorRef,
color,
colorFocus,
colorMuted,
colorRelated,
colorDarkMode,
colorDarkModeFocus,
colorDarkModeMuted,
colorDarkModeRelated,
}: NetzgrafikColorDto = {
id: NetzgrafikColor.incrementId(),
colorRef: "UserDefined",
color: "#767676",
colorFocus: "#000000",
colorMuted: "#DCDCDC",
colorRelated: "#767676",
colorDarkMode: "#767676",
colorDarkModeFocus: "#DCDCDC",
colorDarkModeMuted: "#000000",
colorDarkModeRelated: "#767676",
},
) {
this.id = id;
this.colorRef = colorRef;
this.color = color;
this.colorFocus = colorFocus;
this.colorMuted = colorMuted;
this.colorRelated = colorRelated;
this.colorDarkMode = colorDarkMode;
this.colorDarkModeFocus = colorDarkModeFocus;
this.colorDarkModeMuted = colorDarkModeMuted;
this.colorDarkModeRelated = colorDarkModeRelated;
if (NetzgrafikColor.currentId < this.id) {
NetzgrafikColor.currentId = this.id;
}
}
private static incrementId(): number {
return ++NetzgrafikColor.currentId;
}
getId(): number {
return this.id;
}
getColorRef(): ColorRefType {
return this.colorRef;
}
setColorRef(colorRef: ColorRefType) {
this.colorRef = colorRef;
}
getColors(isDarkMode: boolean) {
if (!isDarkMode) {
return {
color: this.color,
colorFocus: this.colorFocus,
colorMuted: this.colorMuted,
colorRelated: this.colorRelated,
};
}
return {
color: this.colorDarkMode,
colorFocus: this.colorDarkModeFocus,
colorMuted: this.colorDarkModeMuted,
colorRelated: this.colorDarkModeRelated,
};
}
getDto(): NetzgrafikColorDto {
return {
id: this.id,
colorRef: this.colorRef,
color: this.color,
colorFocus: this.colorFocus,
colorMuted: this.colorMuted,
colorRelated: this.colorRelated,
colorDarkMode: this.colorDarkMode,
colorDarkModeFocus: this.colorDarkModeFocus,
colorDarkModeMuted: this.colorDarkModeMuted,
colorDarkModeRelated: this.colorDarkModeRelated,
};
}
}