Skip to content

Commit

Permalink
chroe(app): darkmode
Browse files Browse the repository at this point in the history
  • Loading branch information
StrivingRabbit committed Nov 17, 2022
1 parent 350fbcf commit f9e3ef3
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/platforms/app-plus/service/framework/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,33 @@ function getNavigatorStyle () {
}

export function changePagesNavigatorStyle () {
const theme = getNavigatorStyle()
if (__uniConfig.darkmode) {
const theme = getNavigatorStyle()

setStatusBarStyle(theme)
setStatusBarStyle(theme)

const pages = getCurrentPages(true)
pages.forEach((page) => {
page.$page.meta.statusBarStyle = theme
})
const pages = getCurrentPages(true)
pages.forEach((page) => {
page.$page.meta.statusBarStyle = theme
})
}
}

export function parseTheme (pageStyle) {
let parsedStyle = {}
if (__uniConfig.darkmode) {
let parsedStyle = {}
let theme = plus.navigator.getUIStyle()

const systemInfo = weexGetSystemInfoSync()
// 小程序 SDK
if (systemInfo && systemInfo.hostTheme) {
theme = systemInfo.hostTheme
}

parsedStyle = normallizeStyles(pageStyle, __uniConfig.themeConfig, theme)
return parsedStyle
}
return __uniConfig.darkmode ? parsedStyle : pageStyle
return pageStyle
}

export function useTabBarThemeChange (tabBar, options) {
Expand Down

0 comments on commit f9e3ef3

Please sign in to comment.