From 3880ccbd236935fc0209a35e268057abe073df59 Mon Sep 17 00:00:00 2001 From: QQ Date: Tue, 17 Nov 2026 08:33:53 +0800 Subject: [PATCH] Import apps/android/src/ui/theme-context.tsx --- apps/android/src/ui/theme-context.tsx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/android/src/ui/theme-context.tsx b/apps/android/src/ui/theme-context.tsx index c23a54a..3f747a5 100644 --- a/apps/android/src/ui/theme-context.tsx +++ b/apps/android/src/ui/theme-context.tsx @@ -1,30 +1,42 @@ import { createContext, useContext, useMemo, type ReactNode } from 'react' import { useColorScheme } from 'react-native' import { useAppStore } from '../state/store' -import { colorsForScheme, resolveColorScheme, type ColorScheme, type ThemeColors, type TypographyDensity } from './theme' +import { + DEFAULT_CHAT_APPEARANCE, + resolveColorScheme, + resolveThemeColors, + type ChatAppearance, + type ColorScheme, + type ThemeColors, + type TypographyDensity, +} from './theme' export interface Theme { colors: ThemeColors scheme: ColorScheme density: TypographyDensity + appearance: ChatAppearance } const ThemeContext = createContext({ - colors: colorsForScheme('light'), + colors: resolveThemeColors('light', DEFAULT_CHAT_APPEARANCE.accent), scheme: 'light', density: 'compact', + appearance: DEFAULT_CHAT_APPEARANCE, }) export function ThemeProvider({ children }: { children: ReactNode }) { const themePreference = useAppStore(state => state.themePreference) const density = useAppStore(state => state.typographyDensity) + const appearance = useAppStore(state => state.chatAppearance) const systemScheme = useColorScheme() const scheme = resolveColorScheme(themePreference, systemScheme === 'dark' ? 'dark' : systemScheme === 'light' ? 'light' : undefined) const value = useMemo(() => ({ - colors: colorsForScheme(scheme), + colors: resolveThemeColors(scheme, appearance.accent), scheme, density, - }), [scheme, density]) + appearance, + }), [scheme, density, appearance]) return {children} } @@ -33,4 +45,4 @@ export function useTheme(): Theme { return useContext(ThemeContext) } -export type { ThemeColors, TypographyDensity } from './theme' +export type { ChatAppearance, ThemeColors, TypographyDensity } from './theme'