-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolors.ts
62 lines (57 loc) · 1.56 KB
/
colors.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
type Event = "default" | "halloween";
type Theme = "dark" | "light";
type ContributionLevel = "NONE" | "FIRST_QUARTILE" | "SECOND_QUARTILE" | "THIRD_QUARTILE" | "FOURTH_QUARTILE";
type Colors = {
[key in ContributionLevel]: string;
};
type ColorSet = {
[key in Theme]: Colors;
};
type AllColors = {
[key in Event]: ColorSet;
};
const backgroundColor = (theme: string) => {
return theme === "dark" ? "#000000" : "#FFFFFF";
};
const textColor = (theme: string) => {
return theme === "dark" ? "#FFFFFF" : "#000000";
};
const squareColors = (theme: string, event: string) => {
const allColors: AllColors = {
default: {
dark: {
NONE: "#161b22",
FIRST_QUARTILE: "#0e4429",
SECOND_QUARTILE: "#006d32",
THIRD_QUARTILE: "#26a641",
FOURTH_QUARTILE: "#39d353",
},
light: {
NONE: "#ebedf0",
FIRST_QUARTILE: "#9be9a8",
SECOND_QUARTILE: "#40c463",
THIRD_QUARTILE: "#30a14e",
FOURTH_QUARTILE: "#216e39",
},
},
halloween: {
dark: {
NONE: "#161b22",
FIRST_QUARTILE: "#631c03",
SECOND_QUARTILE: "#bd561d",
THIRD_QUARTILE: "#fa7a18",
FOURTH_QUARTILE: "#fddf68",
},
light: {
NONE: "#ebedf0",
FIRST_QUARTILE: "#ffee4a",
SECOND_QUARTILE: "#ffc501",
THIRD_QUARTILE: "#fe9600",
FOURTH_QUARTILE: "#0c001c",
},
},
};
const colors = allColors[event] ? allColors[event][theme] : allColors.default[theme];
return colors;
};
export { backgroundColor, squareColors, textColor };