Files
MrleeAdmin/frontend/scanapp/utils/theme.js
T

17 lines
543 B
JavaScript
Raw Normal View History

2026-08-31 11:33:59 +08:00
const THEME_MODE_STORAGE_KEY = 'scanapp_theme_mode'
export function getAppThemeMode() {
return uni.getStorageSync(THEME_MODE_STORAGE_KEY) === 'dark' ? 'dark' : 'light'
}
export function applyAppTheme(mode) {
const themeMode = mode === 'dark' ? 'dark' : 'light'
uni.setStorageSync(THEME_MODE_STORAGE_KEY, themeMode)
uni.setNavigationBarColor({
frontColor: themeMode === 'dark' ? '#ffffff' : '#000000',
backgroundColor: themeMode === 'dark' ? '#151923' : '#ffffff'
})
uni.$emit('scanapp-theme-change', themeMode)
return themeMode
}