feat: 添加外观设置与主题配色方案#70
Open
haoyuehx wants to merge 4 commits into
Open
Conversation
Contributor
haoyuehx
commented
May 10, 2026
- 新增「外观设置」页面,支持浅色、深色、跟随系统三种主题模式
- 新增主题色选择能力,默认配色调整为紫罗兰色
- 新增 OLED 优化开关,深色模式下可使用纯黑背景
- 在侧边栏中新增外观设置入口
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 在 Compose Multiplatform 客户端中引入「外观设置」能力,允许用户切换主题模式(浅色/深色/跟随系统)、选择主题种子色,并提供深色模式下的 OLED 纯黑背景优化开关,同时在侧边栏中新增入口以访问该页面。
Changes:
- 重构
UBAATheme:支持传入seedColor并新增 OLED 纯黑背景配色分支。 - 新增「外观设置」页面:主题模式选择、主题色选择、动态配色开关(UI)、OLED 优化开关。
- 主导航与侧边栏新增「外观设置」入口与路由。
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| composeApp/src/commonMain/kotlin/cn/edu/ubaa/ui/theme/Theme.kt | 引入基于种子色的浅/深色方案与 OLED 深色方案,并替换原先固定的 light/dark scheme。 |
| composeApp/src/commonMain/kotlin/cn/edu/ubaa/ui/screens/menu/ThemeSettingsScreen.kt | 新增外观设置 UI(主题模式/主题色/动态配色开关/OLED 优化)。 |
| composeApp/src/commonMain/kotlin/cn/edu/ubaa/ui/navigation/MainAppScreen.kt | 新增 THEME_SETTINGS 路由与参数透传,并接入 ThemeSettingsScreen。 |
| composeApp/src/commonMain/kotlin/cn/edu/ubaa/ui/common/components/Sidebar.kt | 侧边栏新增「外观设置」菜单项与回调。 |
| composeApp/src/commonMain/kotlin/cn/edu/ubaa/App.kt | 在 App 顶层引入主题相关状态,并将其传递到 UBAATheme 与 MainAppScreen。 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+55
to
+61
| val systemDarkTheme = isSystemInDarkTheme() | ||
| var themeMode by rememberSaveable { mutableStateOf(ThemeMode.SYSTEM) } | ||
| var themeColorValue by rememberSaveable { mutableStateOf(0xFF6750A4) } | ||
| var useDynamicColor by rememberSaveable { mutableStateOf(false) } | ||
| var oledEnhance by rememberSaveable { mutableStateOf(false) } | ||
| val themeColor = Color(themeColorValue) | ||
| val darkTheme = |
Comment on lines
+68
to
+72
| UBAATheme( | ||
| darkTheme = darkTheme, | ||
| seedColor = themeColor, | ||
| oledEnhance = oledEnhance, | ||
| ) { |
Comment on lines
+55
to
+59
| val systemDarkTheme = isSystemInDarkTheme() | ||
| var themeMode by rememberSaveable { mutableStateOf(ThemeMode.SYSTEM) } | ||
| var themeColorValue by rememberSaveable { mutableStateOf(0xFF6750A4) } | ||
| var useDynamicColor by rememberSaveable { mutableStateOf(false) } | ||
| var oledEnhance by rememberSaveable { mutableStateOf(false) } |
Comment on lines
+45
to
+49
| return lightColorScheme( | ||
| primary = primary, | ||
| onPrimary = Color.White, | ||
| primaryContainer = blend(primary, Color.White, 0.80f), | ||
| onPrimaryContainer = blend(primary, Color.Black, 0.25f), |
Comment on lines
+270
to
+274
| private fun blend(start: Color, end: Color, amount: Float): Color { | ||
| val clampedAmount = amount.coerceIn(0f, 1f) | ||
| val inverseAmount = 1f - clampedAmount | ||
| return Color( | ||
| red = start.red * inverseAmount + end.red * clampedAmount, |
Comment on lines
+217
to
+223
| Modifier.size(88.dp) | ||
| .clip(cardShape) | ||
| .background(Color(0xFFF1F1F1)) | ||
| .border( | ||
| width = 1.dp, | ||
| color = if (selected) blend(seedColor, Color.Black, 0.10f) else Color.Transparent, | ||
| shape = cardShape, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.