|
1 | 1 | package ai.openclaw.app.ui |
2 | 2 |
|
| 3 | +import ai.openclaw.app.AppearanceThemeMode |
3 | 4 | import ai.openclaw.app.BuildConfig |
4 | 5 | import ai.openclaw.app.GatewayAgentSummary |
5 | 6 | import ai.openclaw.app.GatewayCronJobSummary |
@@ -146,7 +147,7 @@ internal fun SettingsDetailScreen( |
146 | 147 | SettingsRoute.Notifications -> NotificationSettingsScreen(viewModel = viewModel, onBack = onBack) |
147 | 148 | SettingsRoute.PhoneCapabilities -> PhoneCapabilitiesScreen(viewModel = viewModel, onBack = onBack) |
148 | 149 | SettingsRoute.Gateway -> GatewaySettingsScreen(viewModel = viewModel, onBack = onBack) |
149 | | - SettingsRoute.Appearance -> AppearanceSettingsScreen(onBack = onBack) |
| 150 | + SettingsRoute.Appearance -> AppearanceSettingsScreen(viewModel = viewModel, onBack = onBack) |
150 | 151 | SettingsRoute.Health -> HealthLogsSettingsScreen(viewModel = viewModel, onBack = onBack) |
151 | 152 | SettingsRoute.About -> AboutSettingsScreen(viewModel = viewModel, onBack = onBack) |
152 | 153 | } |
@@ -914,18 +915,70 @@ private fun GatewaySettingsScreen( |
914 | 915 | } |
915 | 916 |
|
916 | 917 | @Composable |
917 | | -private fun AppearanceSettingsScreen(onBack: () -> Unit) { |
| 918 | +private fun AppearanceSettingsScreen( |
| 919 | + viewModel: MainViewModel, |
| 920 | + onBack: () -> Unit, |
| 921 | +) { |
| 922 | + val themeMode by viewModel.appearanceThemeMode.collectAsState() |
| 923 | + |
918 | 924 | SettingsDetailFrame(title = "Appearance", subtitle = "A calm, high-contrast OpenClaw interface.", icon = Icons.Default.Palette, onBack = onBack) { |
919 | 925 | SettingsMetricPanel( |
920 | 926 | rows = |
921 | 927 | listOf( |
922 | | - SettingsMetric("Theme", "Dark"), |
| 928 | + SettingsMetric("Theme", appearanceThemeSummary(themeMode)), |
923 | 929 | SettingsMetric("Contrast", "High"), |
924 | 930 | SettingsMetric("Typography", "Readable"), |
925 | 931 | ), |
926 | 932 | ) |
927 | 933 | ClawPanel { |
928 | | - Text(text = "OpenClaw uses a fixed premium dark theme so it stays consistent across devices.", style = ClawTheme.type.body, color = ClawTheme.colors.textMuted) |
| 934 | + Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { |
| 935 | + Text(text = "Theme", style = ClawTheme.type.section, color = ClawTheme.colors.text) |
| 936 | + ClawSegmentedControl( |
| 937 | + options = appearanceThemeOptions(), |
| 938 | + selected = appearanceThemeSummary(themeMode), |
| 939 | + onSelect = { selected -> viewModel.setAppearanceThemeMode(appearanceThemeModeForLabel(selected)) }, |
| 940 | + ) |
| 941 | + } |
| 942 | + } |
| 943 | + ClawPanel { |
| 944 | + Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { |
| 945 | + Text(text = "Palette", style = ClawTheme.type.section, color = ClawTheme.colors.text) |
| 946 | + Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) { |
| 947 | + AppearancePaletteSwatch("Canvas", ClawTheme.colors.canvas, modifier = Modifier.weight(1f)) |
| 948 | + AppearancePaletteSwatch("Surface", ClawTheme.colors.surfaceRaised, modifier = Modifier.weight(1f)) |
| 949 | + AppearancePaletteSwatch( |
| 950 | + "Accent", |
| 951 | + ClawTheme.colors.primary, |
| 952 | + contentColor = ClawTheme.colors.canvas, |
| 953 | + modifier = Modifier.weight(1f), |
| 954 | + ) |
| 955 | + } |
| 956 | + } |
| 957 | + } |
| 958 | + } |
| 959 | +} |
| 960 | + |
| 961 | +internal fun appearanceThemeSummary(mode: AppearanceThemeMode): String = mode.displayLabel |
| 962 | + |
| 963 | +internal fun appearanceThemeOptions(): List<String> = AppearanceThemeMode.entries.map { it.displayLabel } |
| 964 | + |
| 965 | +internal fun appearanceThemeModeForLabel(label: String): AppearanceThemeMode = AppearanceThemeMode.fromDisplayLabel(label) |
| 966 | + |
| 967 | +@Composable |
| 968 | +private fun AppearancePaletteSwatch( |
| 969 | + label: String, |
| 970 | + color: Color, |
| 971 | + contentColor: Color = ClawTheme.colors.text, |
| 972 | + modifier: Modifier = Modifier, |
| 973 | +) { |
| 974 | + Surface( |
| 975 | + modifier = modifier.height(58.dp), |
| 976 | + shape = RoundedCornerShape(ClawTheme.radii.control), |
| 977 | + color = color, |
| 978 | + border = BorderStroke(1.dp, ClawTheme.colors.border), |
| 979 | + ) { |
| 980 | + Box(modifier = Modifier.fillMaxSize().padding(8.dp), contentAlignment = Alignment.BottomStart) { |
| 981 | + Text(text = label, style = ClawTheme.type.caption, color = contentColor, maxLines = 1) |
929 | 982 | } |
930 | 983 | } |
931 | 984 | } |
|
0 commit comments