feat: sync theme background tokens
This commit is contained in:
@@ -9,7 +9,7 @@ interface ThemedPageMetaProps {
|
|||||||
export default function ThemedPageMeta({ darkTop = false }: ThemedPageMetaProps) {
|
export default function ThemedPageMeta({ darkTop = false }: ThemedPageMetaProps) {
|
||||||
const { resolvedTheme } = useThemeContext()
|
const { resolvedTheme } = useThemeContext()
|
||||||
const isDark = resolvedTheme === 'dark' || darkTop
|
const isDark = resolvedTheme === 'dark' || darkTop
|
||||||
const bg = isDark ? '#191919' : '#ffffff'
|
const bg = isDark ? '#191919' : '#faf7f2'
|
||||||
const frontColor = isDark ? '#ffffff' : '#000000'
|
const frontColor = isDark ? '#ffffff' : '#000000'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export function useStatusBar(resolvedTheme: 'light' | 'dark', options: UseStatus
|
|||||||
const apply = useCallback(() => {
|
const apply = useCallback(() => {
|
||||||
const isDarkText = mode === 'dark' || (mode === 'auto' && resolvedTheme === 'light')
|
const isDarkText = mode === 'dark' || (mode === 'auto' && resolvedTheme === 'light')
|
||||||
const frontColor = isDarkText ? '#000000' : '#ffffff'
|
const frontColor = isDarkText ? '#000000' : '#ffffff'
|
||||||
const bgColor = isDarkText ? '#ffffff' : '#191919'
|
const bgColor = isDarkText ? '#faf7f2' : '#191919'
|
||||||
|
|
||||||
Taro.setNavigationBarColor({ frontColor, backgroundColor: bgColor })
|
Taro.setNavigationBarColor({ frontColor, backgroundColor: bgColor })
|
||||||
// 同步页面背景色,确保自定义导航区(状态栏下方、胶囊按钮区域)跟随主题,
|
// 同步页面背景色,确保自定义导航区(状态栏下方、胶囊按钮区域)跟随主题,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Taro from '@tarojs/taro'
|
|||||||
|
|
||||||
/** 实际生效主题对应的窗口/页面背景色 */
|
/** 实际生效主题对应的窗口/页面背景色 */
|
||||||
export function themePageColor(theme: 'light' | 'dark'): string {
|
export function themePageColor(theme: 'light' | 'dark'): string {
|
||||||
return theme === 'dark' ? '#191919' : '#ffffff'
|
return theme === 'dark' ? '#191919' : '#faf7f2'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user