-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy paththeme.ts
86 lines (76 loc) · 1.94 KB
/
theme.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
import type { Theme, ThemeDeclaration, ThemeName, ThemeWithoutFonts } from "./types";
const THEME_LIGHT: ThemeWithoutFonts = {
// general
textColor: "#1E1E1E",
secondaryColor: "#808080",
focusColor: "#1E1E1E",
fontSize: 15,
// badge
badgeBackground: "#ededed",
badgeGap: 3,
badgeHeight: 24,
badgePadding: 0,
badgeLabelPadding: 8,
badgeRadius: 4,
// popup
popupBackground: "#fff",
popupRadius: 4,
popupShadow: "0 4px 8px rgb(0 0 0 / 0.1)",
};
const THEME_DARK: ThemeWithoutFonts = {
...THEME_LIGHT,
textColor: "#D9D9D9",
secondaryColor: "#808080",
focusColor: "#D9D9D9",
badgeBackground: "#1E1E1E",
popupBackground: "#1E1E1E",
};
const THEME_UNIFIED_BASE: Partial<ThemeWithoutFonts> = {
badgeHeight: 32,
badgePadding: 4,
badgeLabelPadding: 6,
badgeGap: 0,
badgeBackground: "none",
badgeRadius: 32,
};
const THEME_SIMPLE_BASE: Partial<ThemeWithoutFonts> = {
badgeBackground: "none",
badgeGap: 0,
badgeLabelPadding: 4,
badgeIconRadius: 12,
};
const DEFAULT_THEME: ThemeName = "light";
export const THEMES: Record<ThemeName, ThemeWithoutFonts> = {
"light": THEME_LIGHT,
"dark": THEME_DARK,
"unified-light": {
...THEME_LIGHT,
...THEME_UNIFIED_BASE,
badgeBackground: "#ededed",
},
"unified-dark": {
...THEME_DARK,
...THEME_UNIFIED_BASE,
badgeBackground: "#1E1E1E",
},
"simple-light": {
...THEME_LIGHT,
...THEME_SIMPLE_BASE,
},
"simple-dark": {
...THEME_DARK,
...THEME_SIMPLE_BASE,
},
};
// Get a theme object from a declaration, inheriting
// from the specified base theme or the default one.
export function getTheme(declaration: ThemeDeclaration = "light"): Theme {
const { base, ...themeWithoutBase } = (
typeof declaration === "string" ? { base: declaration } : declaration
);
return {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
...base && THEMES[base] || THEMES[DEFAULT_THEME],
...themeWithoutBase,
};
}