Skip to content

Commit d095113

Browse files
authored
refactor(android): collapse the chat's second color palette into ClawTheme (#125020)
* refactor(android): consolidate chat palette * refactor(android): fold the font family into ClawTheme
1 parent f7a8638 commit d095113

8 files changed

Lines changed: 110 additions & 311 deletions

File tree

‎apps/android/app/src/main/java/ai/openclaw/app/AndroidScreenshotFixture.kt‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ internal object AndroidScreenshotFixture {
289289
add(
290290
chatMessage(
291291
"assistant",
292-
"The main thread asks for a regression test around session restore, and the second one wants the new " +
293-
"config key documented before merge. Both are small; I can draft patches for each if you want.",
292+
"The release check is ready:\n\n```kotlin\nval ready = lint && tests\n```\n\n" +
293+
"Review https://openclaw.ai before tagging.",
294294
1_783_555_200_000,
295295
),
296296
)
@@ -343,6 +343,13 @@ internal object AndroidScreenshotFixture {
343343
put("contextTokens", JsonPrimitive(200_000))
344344
},
345345
)
346+
put(
347+
"inFlightRun",
348+
buildJsonObject {
349+
put("runId", JsonPrimitive("android-screenshot-active-run"))
350+
put("text", JsonPrimitive(""))
351+
},
352+
)
346353
}.toString()
347354

348355
private fun chatMessage(

‎apps/android/app/src/main/java/ai/openclaw/app/ui/MobileUiTokens.kt‎

Lines changed: 0 additions & 205 deletions
This file was deleted.

‎apps/android/app/src/main/java/ai/openclaw/app/ui/OpenClawTheme.kt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import androidx.core.view.WindowCompat
1717
internal val LocalResolvedAppearanceIsDark = staticCompositionLocalOf { false }
1818

1919
/**
20-
* App theme wrapper that installs dynamic Material colors and legacy mobile color tokens.
20+
* App theme wrapper that resolves the requested appearance for system surfaces and child themes.
2121
*/
2222
@Composable
2323
fun OpenClawTheme(
@@ -27,12 +27,10 @@ fun OpenClawTheme(
2727
val context = LocalContext.current
2828
val isDark = themeMode.isDark(systemDark = isSystemInDarkTheme())
2929
val colorScheme = if (isDark) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
30-
val mobileColors = if (isDark) darkMobileColors() else lightMobileColors()
3130

3231
OpenClawSystemBarAppearance(lightAppearance = !isDark)
3332

3433
CompositionLocalProvider(
35-
LocalMobileColors provides mobileColors,
3634
LocalResolvedAppearanceIsDark provides isDark,
3735
) {
3836
MaterialTheme(colorScheme = colorScheme, content = content)

‎apps/android/app/src/main/java/ai/openclaw/app/ui/chat/ChatMarkdown.kt‎

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ package ai.openclaw.app.ui.chat
33
import ai.openclaw.app.chat.CHAT_IMAGE_MAX_BASE64_CHARS
44
import ai.openclaw.app.i18n.nativeString
55
import ai.openclaw.app.ui.design.ClawTheme
6-
import ai.openclaw.app.ui.mobileAccent
7-
import ai.openclaw.app.ui.mobileCallout
8-
import ai.openclaw.app.ui.mobileCaption1
9-
import ai.openclaw.app.ui.mobileCodeBg
10-
import ai.openclaw.app.ui.mobileCodeText
11-
import ai.openclaw.app.ui.mobileTextSecondary
126
import androidx.compose.foundation.BorderStroke
137
import androidx.compose.foundation.Image
148
import androidx.compose.foundation.background
@@ -120,7 +114,12 @@ fun ChatMarkdown(
120114
) {
121115
val blocks = remember(text, isStreaming) { segmentChatMarkdown(text, isStreaming) }
122116
val inlineStyles =
123-
InlineStyles(inlineCodeBg = mobileCodeBg, inlineCodeColor = mobileCodeText, linkColor = mobileAccent, baseCallout = mobileCallout)
117+
InlineStyles(
118+
inlineCodeBg = ClawTheme.colors.codeBg,
119+
inlineCodeColor = ClawTheme.colors.codeText,
120+
linkColor = ClawTheme.colors.accent,
121+
baseCallout = ClawTheme.type.body,
122+
)
124123

125124
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
126125
for (block in blocks) {
@@ -225,7 +224,7 @@ private fun RenderCommonMarkBlock(
225224
Modifier
226225
.width(2.dp)
227226
.fillMaxHeight()
228-
.background(mobileTextSecondary.copy(alpha = 0.35f)),
227+
.background(ClawTheme.colors.textMuted.copy(alpha = 0.35f)),
229228
)
230229
Column(
231230
modifier = Modifier.weight(1f),
@@ -272,7 +271,7 @@ private fun RenderCommonMarkBlock(
272271
Modifier
273272
.fillMaxWidth()
274273
.height(1.dp)
275-
.background(mobileTextSecondary.copy(alpha = 0.25f)),
274+
.background(ClawTheme.colors.textMuted.copy(alpha = 0.25f)),
276275
)
277276
}
278277
is HtmlBlock -> {
@@ -290,7 +289,7 @@ private fun RenderLiteralHtml(
290289
if (literal.isNotEmpty()) {
291290
Text(
292291
text = literal,
293-
style = mobileCallout.copy(fontFamily = FontFamily.Monospace),
292+
style = ClawTheme.type.body.copy(fontFamily = FontFamily.Monospace),
294293
color = textColor,
295294
)
296295
}
@@ -326,11 +325,11 @@ private fun RenderMarkdownDisclosure(
326325
) {
327326
Text(
328327
text = if (isExpanded) "▾" else "▸",
329-
style = mobileCallout.copy(fontWeight = FontWeight.SemiBold),
328+
style = ClawTheme.type.body.copy(fontWeight = FontWeight.SemiBold),
330329
)
331330
Text(
332331
text = summary,
333-
style = mobileCallout.copy(fontWeight = FontWeight.SemiBold),
332+
style = ClawTheme.type.body.copy(fontWeight = FontWeight.SemiBold),
334333
color = textColor,
335334
)
336335
}
@@ -499,7 +498,7 @@ private fun RenderTableBlock(
499498
Modifier
500499
.fillMaxWidth()
501500
.horizontalScroll(scrollState)
502-
.border(1.dp, mobileTextSecondary.copy(alpha = 0.25f)),
501+
.border(1.dp, ClawTheme.colors.textMuted.copy(alpha = 0.25f)),
503502
) {
504503
for (row in rows) {
505504
Row(
@@ -509,11 +508,11 @@ private fun RenderTableBlock(
509508
val cell = row.cells.getOrNull(index) ?: AnnotatedString("")
510509
Text(
511510
text = cell,
512-
style = if (row.isHeader) mobileCaption1.copy(fontWeight = FontWeight.SemiBold) else inlineStyles.baseCallout,
511+
style = if (row.isHeader) ClawTheme.type.caption.copy(fontWeight = FontWeight.SemiBold) else inlineStyles.baseCallout,
513512
color = textColor,
514513
modifier =
515514
Modifier
516-
.border(1.dp, mobileTextSecondary.copy(alpha = 0.22f))
515+
.border(1.dp, ClawTheme.colors.textMuted.copy(alpha = 0.22f))
517516
.padding(horizontal = 8.dp, vertical = 6.dp)
518517
.width(160.dp),
519518
)
@@ -1213,8 +1212,8 @@ private fun InlineBase64Image(
12131212
Text(
12141213
text = nativeString("Image unavailable"),
12151214
modifier = Modifier.padding(vertical = 2.dp),
1216-
style = mobileCaption1,
1217-
color = mobileTextSecondary,
1215+
style = ClawTheme.type.caption,
1216+
color = ClawTheme.colors.textMuted,
12181217
)
12191218
}
12201219
}

0 commit comments

Comments
 (0)