-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy paththeme.ts
More file actions
35 lines (30 loc) · 1.07 KB
/
theme.ts
File metadata and controls
35 lines (30 loc) · 1.07 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
(function () {
if (window.uitgAppContext?.ThemeController) return;
function init() {
DevExpress.ui.themes.current(window.localStorage.getItem("dx-theme") || "fluent.blue.light");
window.localStorage.setItem("dx-theme", DevExpress.ui.themes.current());
}
function getTheme() {
return DevExpress.ui.themes.current();
}
function themeButtonOnInitialized(e: any) {
const icon = getTheme() === "fluent.blue.light" ? "moon" : "sun";
e.component?.option("icon", icon);
}
function themeSwitcherOnClick(e: any) {
if (getTheme() === "fluent.blue.light") {
e.component.option("icon", "sun");
DevExpress.ui.themes.current("fluent.blue.dark");
} else {
e.component.option("icon", "moon");
DevExpress.ui.themes.current("fluent.blue.light");
}
window.localStorage.setItem("dx-theme", getTheme());
}
window.uitgAppContext.ThemeController = {
init,
getTheme,
themeButtonOnInitialized,
themeSwitcherOnClick
};
})();