Skip to content

feat: 添加外观设置与主题配色方案#70

Open
haoyuehx wants to merge 4 commits into
BUAASubnet:devfrom
haoyuehx:dev
Open

feat: 添加外观设置与主题配色方案#70
haoyuehx wants to merge 4 commits into
BUAASubnet:devfrom
haoyuehx:dev

Conversation

@haoyuehx
Copy link
Copy Markdown
Contributor

  • 新增「外观设置」页面,支持浅色、深色、跟随系统三种主题模式
  • 新增主题色选择能力,默认配色调整为紫罗兰色
  • 新增 OLED 优化开关,深色模式下可使用纯黑背景
  • 在侧边栏中新增外观设置入口

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants