-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy paththemeTools.ts
More file actions
56 lines (48 loc) · 1.11 KB
/
Copy paththemeTools.ts
File metadata and controls
56 lines (48 loc) · 1.11 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
49
50
51
52
53
54
55
56
import { DEFAULT_CONFIGURATION } from "./config";
import DokiThemeDefinitions from "./DokiThemeDefinitions";
export interface StringDictonary<T> {
[key: string]: T;
}
export enum StickerType {
DEFAULT = "DEFAULT",
SECONDARY = "SECONDARY",
}
export interface Wallpaper {
name: string;
anchor: string;
opacity: number;
}
export interface Sticker {
path: string;
name: string;
background: Wallpaper
}
export interface DokiSticker {
type: StickerType;
sticker: Sticker;
}
export interface ThemeInformation {
id: string;
name: string;
displayName: string;
dark: boolean;
author: string;
group: string;
}
export interface DokiTheme {
colors: StringDictonary<string>;
stickers: {
default: Sticker;
secondary?: Sticker;
};
information: ThemeInformation;
}
export const getThemeByName = (themeName: string | undefined): DokiTheme => {
const definedThemeId = themeName || DEFAULT_CONFIGURATION.themeId;
// @ts-ignore
const maybeDokiTheme = DokiThemeDefinitions[definedThemeId];
return (
maybeDokiTheme ||
DokiThemeDefinitions["420b0ed5-803c-4127-97e3-dae6aa1a5972"]
);
};