feat(chat): implement dynamic theme support in chat components
All checks were successful
Frontend CI / build-and-push-web (push) Successful in 7m31s
Frontend CI / ota-android (push) Successful in 13m19s
Frontend CI / build-android-apk (push) Successful in 1h10m3s

- Enhanced ChatHeader and ChatInput components to support dynamic theme colors, improving visual consistency across different themes.
- Updated styles in ChatScreen to utilize new dynamic styles for better responsiveness and user experience.
- Refactored styles in various profile screens to adopt a unified background color scheme and improved spacing for a cleaner layout.

This update significantly enhances the chat interface and profile settings by allowing for dynamic theming and improved visual elements.
This commit is contained in:
lafay
2026-04-02 17:55:56 +08:00
parent 72842352d9
commit e8651215f7
9 changed files with 213 additions and 245 deletions

View File

@@ -25,25 +25,34 @@ export function useChatDynamicStyles() {
const fontSize = useChatSettingsStore((s) => s.fontSize);
const messageRadius = useChatSettingsStore((s) => s.messageRadius);
const themeIndex = useChatSettingsStore((s) => s.themeIndex);
const nightMode = useChatSettingsStore((s) => s.nightMode);
const theme = CHAT_THEMES[themeIndex];
const colors = useAppColors();
// 夜间模式优先:当开启夜间模式时,使用系统暗色,忽略主题设置
// 判断是否为暗色模式chat.nightMode 设置 或 系统暗色模式(背景色为暗色)
const isSystemDarkMode = (colors.chat.screen as string).startsWith('#0') ||
(colors.chat.screen as string) === '#0A0A0A' ||
(colors.chat.screen as string) === '#121212';
const isNightMode = nightMode || isSystemDarkMode;
return {
fontSize,
messageRadius,
// 气泡颜
outgoingBubbleColor: theme.bubble,
// 夜间模式时使用系统暗色,否则使用主题
outgoingBubbleColor: isNightMode ? colors.chat.bubbleOutgoing : theme.bubble,
// 背景色
chatBackgroundColor: theme.secondary,
chatBackgroundColor: isNightMode ? colors.chat.screen : theme.secondary,
// 卡片/头部背景色
cardBackgroundColor: theme.card,
cardBackgroundColor: isNightMode ? colors.chat.card : theme.card,
// 输入框背景色
inputBackgroundColor: theme.inputBg,
inputBackgroundColor: isNightMode ? colors.chat.surfaceRaised : theme.inputBg,
// 面板背景色
panelBackgroundColor: theme.panelBg,
panelBackgroundColor: isNightMode ? colors.chat.surfaceMuted : theme.panelBg,
// 主要文字颜色
textPrimaryColor: theme.textPrimary,
textPrimaryColor: isNightMode ? colors.chat.textPrimary : theme.textPrimary,
// 次要文字颜色
textSecondaryColor: theme.textSecondary,
textSecondaryColor: isNightMode ? colors.chat.textSecondary : theme.textSecondary,
};
}