()
| 81 | const resetTheme = () => (currentTheme.value = AppTheme.LIGHT); |
| 82 | |
| 83 | const initAppTheme = async () => { |
| 84 | if ( |
| 85 | isNaN(currentTheme.value) || |
| 86 | currentTheme.value < AppTheme.AUTO || |
| 87 | currentTheme.value > AppTheme.DARK |
| 88 | ) { |
| 89 | resetTheme(); |
| 90 | } |
| 91 | const fn = { |
| 92 | [AppTheme.AUTO]: () => (isPreferredDark.value ? setDark() : setLight()), |
| 93 | [AppTheme.LIGHT]: () => setLight(), |
| 94 | [AppTheme.DARK]: () => setDark() |
| 95 | }; |
| 96 | fn[currentTheme.value]?.(); |
| 97 | |
| 98 | const frontendSettings = await getSettingsConfig(); |
| 99 | if (frontendSettings?.theme?.backgroundImage) |
| 100 | setBackgroundImage(frontendSettings.theme.backgroundImage); |
| 101 | const pos = frontendSettings?.theme?.sidebarPosition; |
| 102 | sidebarPosition.value = pos === "left" || pos === "right" ? pos : "left"; |
| 103 | }; |
| 104 | |
| 105 | const setTheme = (t: AppTheme) => { |
| 106 | currentTheme.value = t; |
no test coverage detected