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

17 lines
543 B
JavaScript

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
}