feat(chat): implement dynamic theme support in chat components
- 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:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user