diff --git a/AGENTS.md b/AGENTS.md
index de24ecf7c..631e6b8e7 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -21,10 +21,17 @@ testing once `PLAY_OPEN_TESTING` is on). `scheduled-release.yml` releases `main`
still make sense so the two codebases diff side by side.
- Track every iOS file in `docs/parity/.md` (see [docs/parity/README.md](docs/parity/README.md))
and update the row in the same commit.
-- Visuals are Android-native: Material 3 Expressive components and surfaces (Liquid Glass →
- M3 surfaces/tonal elevation, SF Symbols → Material Symbols via `OpenCodeIcons`, SF → Roboto;
- BerkeleyMono only for onboarding brand marks). No glass/blur imitation, no web views as the
- app shell, no React Native/Flutter/KMP UI.
+- Visuals follow the OpenCode desktop design system (`packages/ui` in the opencode repo), not
+ iOS: Inter for UI text and IBM Plex Mono for code and tool output (bundled, OFL), the
+ desktop's type scale in sp, flat surfaces with hairline borders instead of tonal elevation
+ or glass, small radii (`OpenCodeRadius`, `OpenCodeShape.control`), the desktop palette as
+ the default theme (`BrandPalette`). Use `core/ui` tokens and `OpenCodeSurfaces`
+ (`OpenCodeAlertDialog`, floating fill + `openCodeHairline`) rather than raw Material
+ colours or capsules. Behaviour stays Android: Material components' structure, system back
+ and predictive back, sheets, IME, TalkBack semantics, ≥48 dp targets and font scaling.
+ Android looks different from iOS on purpose; behaviour, flows and copy still follow iOS.
+ SF Symbols → Material Symbols via `OpenCodeIcons`; BerkeleyMono only for the wordmark. No
+ glass/blur imitation, no web views as the app shell, no React Native/Flutter/KMP UI.
## Modules (fixed; never edit `settings.gradle.kts`)
@@ -87,14 +94,17 @@ already wired by its parent; keep those names.
(composables). Same rules as iOS (answer the press; navigation and closing stay quiet).
- Design system (`ai.opencode.core.ui`, `ai.opencode.core.motion`; details in
`docs/parity/core-ui.md`): wrap roots in `OpenCodeAppTheme {}`; iOS semantic colours via
- `OpenCodeTheme.colors.*`, M3 roles via `MaterialTheme.colorScheme`; iOS text styles via
- `OpenCodeTextStyles.*` or `MaterialTheme.typography`; `OpenCodeShape`/`OpenCodeRadius`/
- `OpenCodeSpacing`; iOS springs via `Motion.*.spec()` (respects reduce motion).
+ `OpenCodeTheme.colors.*` (`border` follows high contrast), M3 roles via
+ `MaterialTheme.colorScheme`; text styles under iOS names via `OpenCodeTextStyles.*` (desktop
+ sizes) or `MaterialTheme.typography`; `OpenCodeShape`/`OpenCodeRadius`/`OpenCodeSpacing`;
+ floating panels, dialogs and popovers via `OpenCodeSurfaces`; iOS springs via
+ `Motion.*.spec()` (respects reduce motion).
- Icons: `OpenCodeIcon(SFSymbol.X, contentDescription)` or `OpenCodeIcon("sf.name", …)`. To add
one: a line in `scripts/material-symbols.txt`, run `python3 scripts/fetch-material-symbols.py`,
add the `SFSymbol` entry and the core-ui.md row (the coordinator commits shared files).
- Buttons: `OpenCodePrimaryButton` (Next/Send), `OpenCodeSecondaryButton` (Back/Skip); red only
- for destructive roles. Touch targets ≥ 48dp (`Modifier.openCodeTapTarget`, after `clickable`),
+ for destructive roles. A raw Material `Button` takes `shape = OpenCodeShape.control` (Material
+ defaults to a capsule); dialogs use `OpenCodeAlertDialog`. Touch targets ≥ 48dp (`Modifier.openCodeTapTarget`, after `clickable`),
`OpenCodeIconButton` for icon controls.
- Unfinished features stay behind Experimental, off by default, as on iOS.
diff --git a/app/src/main/kotlin/ai/opencode/app/AppView.kt b/app/src/main/kotlin/ai/opencode/app/AppView.kt
index 806b25fdf..c698ebc91 100644
--- a/app/src/main/kotlin/ai/opencode/app/AppView.kt
+++ b/app/src/main/kotlin/ai/opencode/app/AppView.kt
@@ -1,5 +1,11 @@
package ai.opencode.app
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
+import ai.opencode.core.ui.OpenCodeSurfaces
+import androidx.compose.ui.unit.sp
+import ai.opencode.core.ui.OpenCodeRadius
+import androidx.compose.foundation.BorderStroke
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.diagnostics.HidesFromScreenshots
import ai.opencode.core.experiments.key
@@ -66,7 +72,7 @@ import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.foundation.verticalScroll
-import androidx.compose.material3.AlertDialog
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.CircularProgressIndicator
@@ -74,7 +80,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
-import androidx.compose.material3.OutlinedTextField
+import ai.opencode.core.ui.OpenCodeTextField
import androidx.compose.material3.SheetValue
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@@ -211,7 +217,7 @@ private fun AppAlerts(store: StoreOf) {
systemActionError?.let { ErrorAlert("Couldn’t Open Session", it) { store.send(AppFeature.Action.SystemActionErrorDismissed) } }
pairingError?.let { ErrorAlert("Couldn’t Pair with Server", it) { store.send(AppFeature.Action.PairingErrorDismissed) } }
pendingPairing?.let { pending ->
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { store.send(AppFeature.Action.PairingCancelled(pending.id)) },
title = { Text(pending.title) },
text = { Text(pending.message) },
@@ -223,7 +229,7 @@ private fun AppAlerts(store: StoreOf) {
@Composable
private fun ErrorAlert(title: String, message: String, onDismiss: () -> Unit) {
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = onDismiss,
title = { Text(title) },
text = { Text(message) },
@@ -315,9 +321,10 @@ private fun PairingActionsButtons(store: StoreOf Unit,
) {
Button(
onClick = onClick,
enabled = enabled,
- shape = RoundedCornerShape(16.dp),
+ // The desktop's button: small radius, not a 16 dp card.
+ shape = RoundedCornerShape(OpenCodeRadius.fill),
+ border = border,
colors = ButtonDefaults.buttonColors(
containerColor = container,
contentColor = content,
@@ -357,11 +367,17 @@ private fun PairingActionButton(
disabledContentColor = content,
),
contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 16.dp, vertical = 12.dp),
- modifier = Modifier.fillMaxWidth().heightIn(min = 52.dp),
+ modifier = Modifier.fillMaxWidth().heightIn(min = 48.dp),
content = label,
)
}
+/**
+ * The pairing buttons' label. Semibold, a step above the desktop's medium button text: on these
+ * full-width buttons, the screen's two main actions, medium read as softer than the copy above.
+ */
+private val PairingActionLabel get() = OpenCodeTextStyles.callout.copy(fontWeight = FontWeight.SemiBold)
+
/** What a new user needs on their computer before the scan can work. */
@Composable
private fun SetupSteps(store: StoreOf) {
@@ -454,8 +470,12 @@ private fun CopyCommand(command: String, onCopy: (String) -> Unit) {
onCopy(command)
copied = true
},
- shape = RoundedCornerShape(8.dp),
- color = MaterialTheme.colorScheme.surfaceContainerHighest,
+ // The desktop's shell block: a clearly filled box, hairline border.
+ shape = RoundedCornerShape(OpenCodeRadius.fill),
+ color = OpenCodeSurfaces.commandFill,
+ // Explicit: the fill matches `surfaceVariant`, whose content colour is the secondary text.
+ contentColor = OpenCodeTheme.colors.text,
+ border = BorderStroke(1.dp, OpenCodeTheme.colors.border),
// The label stands in for the visible command (cleared below), read once as a button
// (iOS `.accessibilityLabel("Copy \(command)")` on a `Button`).
modifier = Modifier.heightIn(min = 48.dp).semantics {
@@ -472,11 +492,10 @@ private fun CopyCommand(command: String, onCopy: (String) -> Unit) {
Text(
command,
modifier = Modifier.weight(1f, fill = false).clearAndSetSemantics {},
- // Berkeley Mono's contextual alternates join `//` and `--` into ligatures that
- // read as `https: //`; a command to retype is drawn as typed.
- style = OpenCodeTextStyles.callout.copy(
- fontFamily = OpenCodeFonts.berkeleyMono,
- fontSize = OpenCodeTextStyles.subheadline.fontSize,
+ // The desktop's mono; no contextual alternates, so a command to retype is drawn as typed.
+ style = OpenCodeTextStyles.footnote.copy(
+ fontFamily = OpenCodeFonts.monospace,
+ lineHeight = 20.sp,
fontFeatureSettings = "calt 0",
),
)
@@ -568,7 +587,7 @@ private fun SavedServerList(store: StoreOf,
}
}
pendingRemoval?.let { server ->
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { pendingRemoval = null },
title = { Text("Remove ${server.displayName}?") },
text = { Text("This forgets the address and password on this ${ThisDevice.name}. Sessions on the server are not affected.") },
@@ -604,7 +623,7 @@ private fun formatted(message: String): AnnotatedString = buildAnnotatedString {
return@buildAnnotatedString
}
parts.forEachIndexed { index, part ->
- if (index % 2 == 1) withStyle(SpanStyle(fontFamily = FontFamily.Monospace)) { append(part) } else append(part)
+ if (index % 2 == 1) withStyle(SpanStyle(fontFamily = OpenCodeFonts.monospace)) { append(part) } else append(part)
}
}
@@ -694,6 +713,8 @@ private fun ServerFormSheet(store: StoreOf)
ModalBottomSheet(
onDismissRequest = { store.send(AppFeature.Action.CancelEditingTapped) },
sheetState = sheetState,
+ dragHandle = { OpenCodeSheetHandle() },
+ shape = OpenCodeSheetDefaults.shape,
) {
// Its password and headers, out of problem reports and voice screenshots.
HidesFromScreenshots()
@@ -750,30 +771,30 @@ private fun ServerFormSheet(store: StoreOf)
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
state.errorMessage?.let { ConnectionErrorCard(store, it, announces = false) }
- OutlinedTextField(
+ OpenCodeTextField(
value = state.serverName,
onValueChange = { store.send(AppFeature.Action.ServerNameChanged(it)) },
- label = { Text("Name") },
+ label = "Name",
// Blank keeps the name the address gives, shown as the prompt.
- placeholder = { Text(state.credentialNamePrompt) },
+ placeholder = state.credentialNamePrompt,
singleLine = true,
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Words, autoCorrectEnabled = false, imeAction = ImeAction.Next),
modifier = Modifier.fillMaxWidth(),
)
- OutlinedTextField(
+ OpenCodeTextField(
value = state.serverURL,
onValueChange = { store.send(AppFeature.Action.ServerURLChanged(it)) },
- label = { Text("Server address") },
- placeholder = { Text("http://192.168.1.20:4096") },
+ label = "Server address",
+ placeholder = "http://192.168.1.20:4096",
singleLine = true,
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri, autoCorrectEnabled = false, imeAction = ImeAction.Next),
modifier = Modifier.fillMaxWidth(),
)
- OutlinedTextField(
+ OpenCodeTextField(
value = state.username,
onValueChange = { store.send(AppFeature.Action.UsernameChanged(it)) },
- label = { Text("Username") },
- placeholder = { Text("opencode") },
+ label = "Username",
+ placeholder = "opencode",
singleLine = true,
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None, autoCorrectEnabled = false, imeAction = ImeAction.Next),
modifier = Modifier.fillMaxWidth(),
@@ -785,15 +806,15 @@ private fun ServerFormSheet(store: StoreOf)
// eye sits over it, outside the swap, so TalkBack's focus stays on it.
Box {
androidx.compose.runtime.key(revealsPassword) {
- OutlinedTextField(
+ OpenCodeTextField(
// Its own value, so the new field keeps the caret where it was.
value = if (passwordValue.text == state.password) passwordValue else TextFieldValue(state.password, TextRange(state.password.length)),
onValueChange = {
passwordValue = it
if (it.text != state.password) store.send(AppFeature.Action.PasswordChanged(it.text))
},
- label = { Text("Password") },
- placeholder = { Text("Password") },
+ label = "Password",
+ placeholder = "Password",
singleLine = true,
visualTransformation = if (revealsPassword) VisualTransformation.None else PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(
@@ -814,8 +835,8 @@ private fun ServerFormSheet(store: StoreOf)
.onFocusChanged { isPasswordFocused = it.isFocused },
)
}
- // The outlined field's 8 dp above its border is the label's.
- Box(Modifier.matchParentSize().padding(top = 8.dp), contentAlignment = Alignment.CenterEnd) {
+ // The label sits above the field: the eye centres on the field's 48 dp row.
+ Box(Modifier.matchParentSize(), contentAlignment = Alignment.BottomEnd) {
OpenCodeIconButton(
symbol = if (revealsPassword) SFSymbol.EyeSlash else SFSymbol.Eye,
contentDescription = if (revealsPassword) "Hide Password" else "Show Password",
@@ -884,14 +905,16 @@ private fun ConnectButton(label: String, inProgress: Boolean, enabled: Boolean,
disabledContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
disabledContentColor = colors.secondaryText,
),
- contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 20.dp, vertical = 12.dp),
- modifier = modifier.fillMaxWidth().heightIn(min = 52.dp),
+ // The desktop's contrast button: small radius, medium label.
+ shape = RoundedCornerShape(OpenCodeRadius.fill),
+ contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 16.dp, vertical = 10.dp),
+ modifier = modifier.fillMaxWidth().heightIn(min = 48.dp),
) {
if (inProgress) {
CircularProgressIndicator(Modifier.size(18.dp), strokeWidth = 2.dp, color = colors.secondaryText)
Spacer(Modifier.width(10.dp))
}
- Text(label, style = OpenCodeTextStyles.headline)
+ Text(label, style = PairingActionLabel)
Spacer(Modifier.weight(1f))
OpenCodeIcon(SFSymbol.ArrowRight, contentDescription = null)
}
@@ -915,20 +938,20 @@ private fun HeaderFields(
Text("Headers", style = OpenCodeTextStyles.caption1.copy(fontWeight = FontWeight.SemiBold), color = OpenCodeTheme.colors.secondaryText)
headers.forEachIndexed { index, header ->
val nameField: @Composable (Modifier) -> Unit = { modifier ->
- OutlinedTextField(
+ OpenCodeTextField(
value = header.name,
onValueChange = { value -> update(index) { it.copy(name = value) } },
- placeholder = { Text("Name") },
+ placeholder = "Name",
singleLine = true,
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None, autoCorrectEnabled = false, imeAction = ImeAction.Next),
modifier = modifier.semantics { contentDescription = "Header ${index + 1} name" },
)
}
val valueField: @Composable (Modifier) -> Unit = { modifier ->
- OutlinedTextField(
+ OpenCodeTextField(
value = header.value,
onValueChange = { value -> update(index) { it.copy(value = value) } },
- placeholder = { Text("Value") },
+ placeholder = "Value",
singleLine = true,
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None, autoCorrectEnabled = false, imeAction = ImeAction.Next),
modifier = modifier.semantics { contentDescription = "Header ${index + 1} value" },
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/AppTheme.kt b/core/src/main/kotlin/ai/opencode/core/ui/AppTheme.kt
index 506aa3065..503e89854 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/AppTheme.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/AppTheme.kt
@@ -323,7 +323,7 @@ object ThemePalette {
fun definition(theme: AppTheme): ThemeDefinition = when (theme) {
AppTheme.System -> system
- AppTheme.OpenCode -> opencode
+ AppTheme.OpenCode -> BrandPalette.opencode
AppTheme.TokyoNight -> tokyonight
AppTheme.Catppuccin -> catppuccin
AppTheme.Dracula -> dracula
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/BrandPalette.kt b/core/src/main/kotlin/ai/opencode/core/ui/BrandPalette.kt
new file mode 100644
index 000000000..d05433c5b
--- /dev/null
+++ b/core/src/main/kotlin/ai/opencode/core/ui/BrandPalette.kt
@@ -0,0 +1,90 @@
+package ai.opencode.core.ui
+
+/**
+ * The OpenCode desktop/web palette (`packages/ui` theme `oc-2`, its `--v2-*` tokens), used for
+ * [AppTheme.OpenCode] instead of the iOS-generated palette. Neutral and monochrome like the
+ * desktop app: the accent is the desktop's contrast fill (`--v2-background-bg-contrast` /
+ * `--v2-background-bg-icon-button-contrast`), blue is kept for links.
+ *
+ * Desktop token → field:
+ * canvas `bg-base`, canvasWeak `bg-deep` (sidebar), codeBand `bg-layer-01`, userBubble
+ * `bg-layer-02`, surfaceStrong `bg-layer-03`, text/strong `text-base`, textWeak `text-muted`,
+ * textTertiary `text-faint`, border `border-base` (flattened), borderStrong `border-strong`,
+ * link `text-accent`, syntax `--syntax-*`, diff `--v2-state-*-success/danger`.
+ *
+ * Light-mode divergences from the desktop, each darkened just enough for WCAG AA (4.5:1) on the
+ * fills it sits on (white, `#FAFAFA` code/drawer, `#EEEEEE` inline code): textTertiary `#808080`
+ * → `#6E6E6E`, link `#3B5CF6` → `#3A5BF6`, syntax keyword `#C83D8B` → `#C83B8A`, syntax string
+ * `#198B43` → `#188540`, diff-added text `#198B43` → `#17813E`. Dark mode is the desktop's.
+ */
+internal object BrandPalette {
+ private fun hex(value: String, alpha: Double = 1.0): ThemeRGBA {
+ val v = value.removePrefix("#").toLong(16)
+ return ThemeRGBA(((v shr 16) and 0xFF) / 255.0, ((v shr 8) and 0xFF) / 255.0, (v and 0xFF) / 255.0, alpha)
+ }
+
+ val opencode = ThemeDefinition(
+ id = AppTheme.OpenCode,
+ title = "OpenCode",
+ light = ThemeVariant(
+ canvas = hex("#FFFFFF"),
+ canvasWeak = hex("#FAFAFA"),
+ codeBand = hex("#FAFAFA"),
+ userBubble = hex("#F2F2F2"),
+ surfaceStrong = hex("#EEEEEE"),
+ text = hex("#161616"),
+ bodyText = hex("#242424"),
+ textStrong = hex("#0A0A0A"),
+ textWeak = hex("#5C5C5C"),
+ textTertiary = hex("#6E6E6E"),
+ border = hex("#E6E6E6"),
+ borderStrong = hex("#CCCCCC"),
+ accent = hex("#242424"),
+ link = hex("#3A5BF6"),
+ syntaxKeyword = hex("#C83B8A"),
+ syntaxString = hex("#188540"),
+ syntaxNumber = hex("#007B80"),
+ syntaxComment = hex("#5C5C5C"),
+ syntaxType = hex("#5230C2"),
+ diffAddedFill = hex("#E7F9EA"),
+ diffRemovedFill = hex("#FCECEB"),
+ glassDiffAddedFill = hex("#198B43", 0.12),
+ glassDiffRemovedFill = hex("#B82D35", 0.10),
+ diffAddedText = hex("#17813E"),
+ diffRemovedText = hex("#B82D35"),
+ swatchCanvas = hex("#FFFFFF"),
+ swatchRing = hex("#C7C7C7"),
+ swatchAccent = hex("#242424"),
+ ),
+ dark = ThemeVariant(
+ canvas = hex("#161616"),
+ canvasWeak = hex("#101010"),
+ codeBand = hex("#1C1C1C"),
+ userBubble = hex("#2E2E2E"),
+ surfaceStrong = hex("#3A3A3A"),
+ text = hex("#EDEDED"),
+ bodyText = hex("#DDDDDD"),
+ textStrong = hex("#FAFAFA"),
+ textWeak = hex("#AEAEAE"),
+ textTertiary = hex("#8A8A8A"),
+ border = hex("#2D2D2D"),
+ borderStrong = hex("#454545"),
+ accent = hex("#DBDBDB"),
+ link = hex("#A2BCFF"),
+ syntaxKeyword = hex("#F799C6"),
+ syntaxString = hex("#96E3A6"),
+ syntaxNumber = hex("#93E9F6"),
+ syntaxComment = hex("#AEAEAE"),
+ syntaxType = hex("#9E99F7"),
+ diffAddedFill = hex("#14361D"),
+ diffRemovedFill = hex("#461516"),
+ glassDiffAddedFill = hex("#6BD586", 0.14),
+ glassDiffRemovedFill = hex("#F17471", 0.14),
+ diffAddedText = hex("#6BD586"),
+ diffRemovedText = hex("#F17471"),
+ swatchCanvas = hex("#161616"),
+ swatchRing = hex("#454545"),
+ swatchAccent = hex("#DBDBDB"),
+ ),
+ )
+}
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/DesignSystemGallery.kt b/core/src/main/kotlin/ai/opencode/core/ui/DesignSystemGallery.kt
index c0230e993..c5a73e581 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/DesignSystemGallery.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/DesignSystemGallery.kt
@@ -138,8 +138,8 @@ private fun ColorsSection() = Section("Colors") {
"canvas" to c.canvas, "groupedCanvas" to c.groupedCanvas, "groupedCard" to c.groupedCard,
"userBubble" to c.userBubble, "codeBand" to c.codeBand, "inlineCodeFill" to c.inlineCodeFill,
"text" to c.text, "secondaryText" to c.secondaryText, "tertiaryText" to c.tertiaryText,
- "border" to c.border, "accent" to c.accent, "link" to c.link,
- "sendButton" to c.sendButtonBackground, "destructive" to c.destructive,
+ "border" to c.border, "accent" to c.accent, "link" to c.link, "signal" to c.signal,
+ "sendButton" to c.sendButtonBackground, "destructive" to c.destructive, "danger" to c.danger,
"syntaxKeyword" to c.syntaxKeyword, "syntaxString" to c.syntaxString, "syntaxNumber" to c.syntaxNumber,
"syntaxComment" to c.syntaxComment, "syntaxType" to c.syntaxType,
"diffAddedFill" to c.diffAddedFill, "diffRemovedFill" to c.diffRemovedFill,
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/DynamicSystemTheme.kt b/core/src/main/kotlin/ai/opencode/core/ui/DynamicSystemTheme.kt
index 393439d8d..aded9586f 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/DynamicSystemTheme.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/DynamicSystemTheme.kt
@@ -71,7 +71,7 @@ object DynamicSystemTheme {
}
/** The app's semantic colours for the System theme, read from the wallpaper's [scheme]. */
- fun colors(scheme: ColorScheme, isDark: Boolean, highContrast: Boolean): OpenCodeColors {
+ fun colors(scheme: ColorScheme, isDark: Boolean, highContrast: Boolean, strongBorders: Boolean = highContrast): OpenCodeColors {
val fixed = ThemePalette.system.variant(isDark)
val onSurface = scheme.onSurface
val bodyResolver: (Double) -> Color = { tone ->
@@ -81,11 +81,12 @@ object DynamicSystemTheme {
onSurface.copy(alpha = tone.toFloat())
}
}
- val border = if (highContrast) scheme.outline else scheme.outlineVariant
+ val border = if (highContrast || strongBorders) scheme.outline else scheme.outlineVariant
return OpenCodeColors(
theme = AppTheme.System,
isDark = isDark,
highContrast = highContrast,
+ strongBorders = strongBorders || highContrast,
variant = variant(scheme, fixed),
canvas = scheme.surface,
groupedCanvas = scheme.surfaceContainer,
@@ -103,6 +104,7 @@ object DynamicSystemTheme {
sendButtonBackground = scheme.primary,
sendButtonForeground = scheme.onPrimary,
link = scheme.primary,
+ signal = scheme.primary,
syntaxKeyword = fixed.syntaxKeyword.color,
syntaxString = fixed.syntaxString.color,
syntaxNumber = fixed.syntaxNumber.color,
@@ -113,6 +115,7 @@ object DynamicSystemTheme {
diffAddedText = onSurface,
diffRemovedText = onSurface,
destructive = scheme.error,
+ danger = scheme.error,
bodyTextResolver = bodyResolver,
)
}
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeButtons.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeButtons.kt
index 55276ebb6..c63f043bb 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeButtons.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeButtons.kt
@@ -1,8 +1,10 @@
package ai.opencode.core.ui
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.FilledTonalButton
@@ -11,6 +13,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@@ -20,12 +23,15 @@ enum class OpenCodeButtonRole { Normal, Destructive }
object OpenCodeButtonDefaults {
/**
- * Height every peer button shares (iOS `.controlSize(.large)` ≈ 50 pt). Hierarchy comes
- * from style, never size.
+ * Height every peer button shares: the 48 dp touch target (denser than iOS's 50 pt `.large`,
+ * still well above the desktop's 32 px). Hierarchy comes from style, never size.
*/
- val height: Dp = 52.dp
+ val height: Dp = 48.dp
- val contentPadding = PaddingValues(horizontal = 20.dp, vertical = 12.dp)
+ val contentPadding = PaddingValues(horizontal = 16.dp, vertical = 10.dp)
+
+ /** The desktop's button radius (`--radius-md`-ish 8 at phone size), not a capsule. */
+ val shape: Shape = RoundedCornerShape(OpenCodeRadius.fill)
}
/**
@@ -55,6 +61,7 @@ fun OpenCodePrimaryButton(
onClick = onClick,
modifier = modifier.heightIn(min = OpenCodeButtonDefaults.height),
enabled = enabled,
+ shape = OpenCodeButtonDefaults.shape,
colors = colors,
contentPadding = OpenCodeButtonDefaults.contentPadding,
content = content,
@@ -84,15 +91,19 @@ fun OpenCodeSecondaryButton(
role: OpenCodeButtonRole = OpenCodeButtonRole.Normal,
content: @Composable RowScope.() -> Unit,
) {
+ // Desktop neutral button: a light neutral fill with a hairline.
+ val container = OpenCodeSurfaces.neutralFill
val colors = if (role == OpenCodeButtonRole.Destructive) {
- ButtonDefaults.filledTonalButtonColors(contentColor = OpenCodeTheme.colors.destructive)
+ ButtonDefaults.filledTonalButtonColors(containerColor = container, contentColor = OpenCodeTheme.colors.destructive)
} else {
- ButtonDefaults.filledTonalButtonColors()
+ ButtonDefaults.filledTonalButtonColors(containerColor = container, contentColor = OpenCodeTheme.colors.text)
}
FilledTonalButton(
onClick = onClick,
modifier = modifier.heightIn(min = OpenCodeButtonDefaults.height),
enabled = enabled,
+ shape = OpenCodeButtonDefaults.shape,
+ border = BorderStroke(1.dp, OpenCodeTheme.colors.border),
colors = colors,
contentPadding = OpenCodeButtonDefaults.contentPadding,
content = content,
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeColors.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeColors.kt
index 53fa8f72e..5f4012557 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeColors.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeColors.kt
@@ -25,6 +25,11 @@ class OpenCodeColors(
val theme: AppTheme,
val isDark: Boolean,
val highContrast: Boolean,
+ /**
+ * Hairlines draw in the strong border colour: Increase Contrast or Android's high-contrast
+ * text setting (desktop hairlines are under 3:1 against the canvas).
+ */
+ val strongBorders: Boolean,
/** The raw palette, for swatches (`swatchCanvas`, `swatchRing`, `swatchAccent`) and contrast checks. */
val variant: ThemeVariant,
/** Plain backgrounds (iOS `systemBackground`). */
@@ -56,6 +61,11 @@ class OpenCodeColors(
val sendButtonBackground: Color,
val sendButtonForeground: Color,
val link: Color,
+ /**
+ * Unread and new-item indicators (drawer dots, Catch Up). The desktop draws its unread dot
+ * in `--v2-background-bg-accent` (blue), not the neutral [accent]; this is the theme's link blue.
+ */
+ val signal: Color,
val syntaxKeyword: Color,
val syntaxString: Color,
val syntaxNumber: Color,
@@ -67,6 +77,11 @@ class OpenCodeColors(
val diffRemovedText: Color,
/** Destructive roles only (iOS `systemRed`: delete, end call). */
val destructive: Color,
+ /**
+ * Failure text and glyphs (a failed tool, a run error): the desktop's `--v2-state-fg-danger`,
+ * deeper than [destructive] in light and softer in dark. Not for fills behind white labels.
+ */
+ val danger: Color,
private val bodyTextResolver: (Double) -> Color,
) {
/**
@@ -87,7 +102,7 @@ class OpenCodeColors(
* this uses their concrete values (the [ThemePalette.system] reference palette plus the
* UIKit-only fills below).
*/
- fun resolve(theme: AppTheme, isDark: Boolean, highContrast: Boolean = false): OpenCodeColors {
+ fun resolve(theme: AppTheme, isDark: Boolean, highContrast: Boolean = false, strongBorders: Boolean = highContrast): OpenCodeColors {
val v = ThemePalette.definition(theme).variant(isDark)
val system = theme == AppTheme.System
val label = v.text
@@ -104,6 +119,7 @@ class OpenCodeColors(
theme = theme,
isDark = isDark,
highContrast = highContrast,
+ strongBorders = strongBorders || highContrast,
variant = v,
canvas = v.canvas.color,
groupedCanvas = (if (isDark) v.canvas else v.canvasWeak).color,
@@ -120,11 +136,12 @@ class OpenCodeColors(
secondaryText = (if (!system && highContrast) v.text else v.textWeak).color,
tertiaryText = (if (!system && highContrast) v.textWeak else v.textTertiary).color,
defaultBodyText = bodyResolver(0.92),
- border = (if (!system && highContrast) v.borderStrong else v.border).color,
+ border = (if ((!system && highContrast) || strongBorders) v.borderStrong else v.border).color,
accent = v.accent.color,
sendButtonBackground = (if (system) label else v.accent).color,
sendButtonForeground = (if (system) v.canvas else v.accent.highContrastForeground).color,
link = v.link.color,
+ signal = v.link.color,
syntaxKeyword = v.syntaxKeyword.color,
syntaxString = v.syntaxString.color,
syntaxNumber = v.syntaxNumber.color,
@@ -135,6 +152,7 @@ class OpenCodeColors(
diffAddedText = (if (system) label else v.diffAddedText).color,
diffRemovedText = (if (system) label else v.diffRemovedText).color,
destructive = SystemColors.red(isDark).color,
+ danger = (if (system) SystemColors.red(isDark) else v.diffRemovedText).color,
bodyTextResolver = bodyResolver,
)
}
@@ -163,8 +181,7 @@ internal object SystemColors {
* | secondaryContainer / onSecondaryContainer | surfaceStrong (secondary buttons) / text |
* | tertiary / onTertiary | link / white (System) or the link's high-contrast foreground (themes) |
* | background, surface, surfaceContainerLowest | canvas |
- * | surfaceContainerLow | canvasWeak (grouped canvas, light) |
- * | surfaceContainer | canvasWeak ↔ userBubble midpoint |
+ * | surfaceContainerLow, surfaceContainer | System: canvasWeak / canvasWeak ↔ userBubble midpoint; curated themes: the desktop's floating surface ([floating]: canvas in light, a raised step above the canvas in dark), so sheets, menus and tooltips are flat floating panels |
* | surfaceContainerHigh, surfaceVariant | userBubble |
* | surfaceContainerHighest | surfaceStrong |
* | onSurface / onSurfaceVariant | text / secondary text |
@@ -181,9 +198,11 @@ fun OpenCodeColors.toColorScheme(): ColorScheme {
val textRgba = if (!system && highContrast) v.textStrong else v.text
val secondary = (if (!system && highContrast) v.text else v.textWeak).composited(canvas)
val outline = v.borderStrong.composited(canvas)
- val outlineVariant = (if (!system && highContrast) v.borderStrong else v.border).composited(canvas)
+ val outlineVariant = (if ((!system && highContrast) || strongBorders) v.borderStrong else v.border).composited(canvas)
val error = if (system) SystemColors.red(isDark) else v.diffRemovedText
val container = v.canvasWeak.mixedInOklab(v.userBubble, 0.5)
+ // Desktop floating surfaces (sheets, menus, popovers): white in light, a step up in dark.
+ val floatingSurface = if (isDark) v.darkFloatingFill() else canvas
val primaryContainer = canvas.mixedInOklab(accent, 0.22)
val errorContainer = (if (system) SystemColors.red(isDark).withAlpha(0.14) else v.glassDiffRemovedFill).composited(canvas)
val surfaceBright = if (isDark) v.surfaceStrong else canvas
@@ -214,7 +233,8 @@ fun OpenCodeColors.toColorScheme(): ColorScheme {
onSurface = textRgba.color,
surfaceVariant = v.userBubble.color,
onSurfaceVariant = secondary.color,
- surfaceTint = accent.color,
+ // Flat surfaces (desktop): no tonal-elevation tint; depth comes from hairlines.
+ surfaceTint = Color.Transparent,
inverseSurface = v.text.color,
inverseOnSurface = canvas.color,
error = error.color,
@@ -225,10 +245,10 @@ fun OpenCodeColors.toColorScheme(): ColorScheme {
outlineVariant = outlineVariant.color,
surfaceBright = surfaceBright.color,
surfaceDim = surfaceDim.color,
- surfaceContainer = container.color,
+ surfaceContainer = (if (system) container else floatingSurface).color,
surfaceContainerHigh = v.userBubble.color,
surfaceContainerHighest = v.surfaceStrong.color,
- surfaceContainerLow = v.canvasWeak.color,
+ surfaceContainerLow = (if (system) v.canvasWeak else floatingSurface).color,
surfaceContainerLowest = canvas.color,
scrim = Color.Black,
)
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeFormControls.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeFormControls.kt
new file mode 100644
index 000000000..3ca32c1ee
--- /dev/null
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeFormControls.kt
@@ -0,0 +1,217 @@
+package ai.opencode.core.ui
+
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.animation.core.animateDpAsState
+import androidx.compose.animation.core.tween
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.interaction.collectIsPressedAsState
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.offset
+import androidx.compose.foundation.layout.requiredSize
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.wrapContentSize
+import androidx.compose.foundation.selection.toggleable
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.BottomSheetDefaults
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.minimumInteractiveComponentSize
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.ReadOnlyComposable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.alpha
+import androidx.compose.ui.draw.shadow
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.lerp
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.IntOffset
+import androidx.compose.ui.unit.dp
+
+/**
+ * The desktop's switch (`packages/ui` `forms/switch`): a rounded-square track with a square
+ * thumb, no checkmark, 150 ms slides, half opacity when disabled; pressing widens the thumb
+ * toward the middle like the desktop's hover. Sized up for touch: a 40 × 24 dp track and an
+ * 18 dp thumb with concentric corners (7 and 4 dp, 3 dp apart), inside a 48 dp target when it
+ * toggles itself.
+ *
+ * Off is light, as on the desktop: a quiet track fill and a light thumb, with the track's
+ * outline carrying the 3:1 contrast against the row (not a dark thumb). On is the accent with
+ * its foreground thumb. The System theme takes the same roles from Material You.
+ *
+ * A drop-in for Material's `Switch`: the same [checked] / [onCheckedChange] contract (null when
+ * a parent row is the toggleable, as Material's) and `Role.Switch` semantics.
+ */
+@Composable
+fun OpenCodeSwitch(
+ checked: Boolean,
+ onCheckedChange: ((Boolean) -> Unit)?,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ interactionSource: MutableInteractionSource? = null,
+) {
+ val source = interactionSource ?: remember { MutableInteractionSource() }
+ val pressed by source.collectIsPressedAsState()
+ val colors = switchColors()
+
+ var toggle: Modifier = Modifier
+ if (onCheckedChange != null) {
+ toggle = Modifier
+ .minimumInteractiveComponentSize()
+ .toggleable(
+ value = checked,
+ interactionSource = source,
+ indication = null,
+ enabled = enabled,
+ role = Role.Switch,
+ onValueChange = onCheckedChange,
+ )
+ }
+
+ val thumbWidthTarget = if (pressed && enabled) SwitchMetrics.pressedThumbWidth else SwitchMetrics.thumbSize
+ val thumbXTarget = if (checked) {
+ SwitchMetrics.trackWidth - SwitchMetrics.thumbInset - thumbWidthTarget
+ } else {
+ SwitchMetrics.thumbInset
+ }
+ val duration = SwitchMetrics.ANIMATION_MILLIS
+ val thumbWidth by animateDpAsState(thumbWidthTarget, tween(duration), label = "switchThumbWidth")
+ val thumbX by animateDpAsState(thumbXTarget, tween(duration), label = "switchThumbX")
+ val trackColor by animateColorAsState(
+ if (checked) colors.checkedTrack else colors.uncheckedTrack,
+ tween(duration),
+ label = "switchTrack",
+ )
+ val borderColor by animateColorAsState(
+ if (checked) colors.checkedTrack else colors.uncheckedBorder,
+ tween(duration),
+ label = "switchBorder",
+ )
+ val thumbColor by animateColorAsState(
+ if (checked) colors.checkedThumb else colors.uncheckedThumb,
+ tween(duration),
+ label = "switchThumb",
+ )
+
+ val trackShape = SwitchMetrics.trackShape
+ val thumbShape = SwitchMetrics.thumbShape
+ var thumbEdge: Modifier = Modifier
+ if (colors.thumbEdge != Color.Transparent) {
+ thumbEdge = Modifier
+ .shadow(SwitchMetrics.thumbElevation, thumbShape, clip = false, ambientColor = colors.thumbShadow, spotColor = colors.thumbShadow)
+ .border(SwitchMetrics.thumbEdgeWidth, colors.thumbEdge, thumbShape)
+ }
+ Box(
+ modifier
+ .then(toggle)
+ .wrapContentSize(Alignment.Center)
+ .requiredSize(SwitchMetrics.trackWidth, SwitchMetrics.trackHeight)
+ .alpha(if (enabled) 1f else SwitchMetrics.DISABLED_ALPHA)
+ .background(trackColor, trackShape)
+ .border(SwitchMetrics.borderWidth, borderColor, trackShape),
+ contentAlignment = Alignment.CenterStart,
+ ) {
+ Box(
+ Modifier
+ .offset { IntOffset(thumbX.roundToPx(), 0) }
+ .size(thumbWidth, SwitchMetrics.thumbSize)
+ .then(thumbEdge)
+ .background(thumbColor, thumbShape),
+ )
+ }
+}
+
+/** [OpenCodeSwitch]'s resolved colours for the current theme and appearance. */
+private class SwitchColors(
+ val checkedTrack: Color,
+ val checkedThumb: Color,
+ val uncheckedTrack: Color,
+ val uncheckedBorder: Color,
+ val uncheckedThumb: Color,
+ /** A faint edge and shadow that lift a light thumb off a light track; transparent in dark. */
+ val thumbEdge: Color,
+ val thumbShadow: Color,
+)
+
+@Composable
+private fun switchColors(): SwitchColors {
+ val colors = OpenCodeTheme.colors
+ val scheme = MaterialTheme.colorScheme
+ // Off reads through its outline: the row colour mixed most of the way to the muted text
+ // colour is 3:1 or more on the row in every theme (full strength under high contrast).
+ val outlineStrength = if (colors.strongBorders) 1f else SwitchMetrics.OUTLINE_STRENGTH
+ val outline = if (colors.theme == AppTheme.System) {
+ scheme.outline
+ } else {
+ lerp(colors.groupedCard, colors.tertiaryText, outlineStrength)
+ }
+ val lightThumb = if (colors.isDark) colors.secondaryText else scheme.surfaceContainerLowest
+ val edge = if (colors.isDark) Color.Transparent else Color.Black.copy(alpha = 0.10f)
+ return SwitchColors(
+ checkedTrack = scheme.primary,
+ checkedThumb = scheme.onPrimary,
+ uncheckedTrack = scheme.surfaceContainerHighest,
+ uncheckedBorder = outline,
+ uncheckedThumb = lightThumb,
+ thumbEdge = edge,
+ thumbShadow = Color.Black.copy(alpha = 0.35f),
+ )
+}
+
+/**
+ * A bottom sheet's drag handle as the desktop's resize handle (`components/resize-handle`): a
+ * 40 × 4 dp pill in the muted icon colour ([OpenCodeColors.tertiaryText], 3:1 or more on the
+ * sheet). Material's `DragHandle` underneath, so the sheet keeps its band, its "Drag handle"
+ * label and its expand / collapse / dismiss actions.
+ */
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun OpenCodeSheetHandle(modifier: Modifier = Modifier) {
+ BottomSheetDefaults.DragHandle(
+ modifier = modifier,
+ width = OpenCodeSheetHandleDefaults.width,
+ height = OpenCodeSheetHandleDefaults.height,
+ shape = OpenCodeShape.capsule,
+ color = OpenCodeSheetHandleDefaults.color,
+ )
+}
+
+/** The handle pill's size and colour, for sheets that draw their own grabber band. */
+object OpenCodeSheetHandleDefaults {
+ val width: Dp = 40.dp
+ val height: Dp = 4.dp
+
+ val color: Color
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.tertiaryText
+}
+
+/**
+ * Bottom sheets' container shape: [OpenCodeRadius.sheet] (16 dp) on the top corners, squarer than
+ * Material's extra-large sheet corner.
+ */
+object OpenCodeSheetDefaults {
+ val shape: Shape = RoundedCornerShape(topStart = OpenCodeRadius.sheet, topEnd = OpenCodeRadius.sheet)
+}
+
+/** [OpenCodeSwitch]'s geometry: the desktop switch's proportions at touch size. */
+private object SwitchMetrics {
+ val trackWidth: Dp = 40.dp
+ val trackHeight: Dp = 24.dp
+ val borderWidth: Dp = 1.dp
+ val thumbInset: Dp = 3.dp
+ val thumbSize: Dp = 18.dp
+ val pressedThumbWidth: Dp = 21.dp
+ val thumbElevation: Dp = 1.dp
+ val thumbEdgeWidth: Dp = 0.5.dp
+ val trackShape = RoundedCornerShape(7.dp)
+ val thumbShape = RoundedCornerShape(OpenCodeRadius.xs)
+ const val ANIMATION_MILLIS = 150
+ const val DISABLED_ALPHA = 0.5f
+ const val OUTLINE_STRENGTH = 0.85f
+}
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeShapes.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeShapes.kt
index a396b2dbd..1b0d5668a 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeShapes.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeShapes.kt
@@ -9,32 +9,39 @@ import kotlin.math.max
import kotlin.math.min
/**
- * Corner radii the iOS app uses (surveyed from its `cornerRadius:` / `.rect(cornerRadius:)`
- * call sites). iOS draws `.continuous` (squircle) corners; Compose's rounded corners are
- * circular, which reads the same at these sizes.
+ * Corner radii, on this branch the OpenCode desktop's (`--radius-sm` 4, `-md` 6, `-lg` 8,
+ * `-xl` 10, the 12 px dock), keeping the iOS role names so call sites are unchanged. Sheets
+ * keep a larger 16 dp top radius so they still read as Android sheets.
*/
object OpenCodeRadius {
- /** Tiny marks: inline code, checkbox insets (6). */
- val xs: Dp = 6.dp
- /** Small fills and thumbnails (10). */
- val sm: Dp = 10.dp
- /** Tertiary-fill fields and rows (`tertiarySystemFill` boxes, 14). */
- val fill: Dp = 14.dp
- /** Inline controls and trays (16). */
- val control: Dp = 16.dp
- /** Cards and glass cards (server list, error report, 20). */
- val card: Dp = 20.dp
- /** Attachment chips, clipped media, settings tiles (22). */
- val tile: Dp = 22.dp
- /** Large panels: connect, server details, What's New cards (26). */
- val panel: Dp = 26.dp
- /** Sheets, scanner frame, model list, voice panel (28). */
- val sheet: Dp = 28.dp
+ /** Tiny marks: inline code, checkbox insets (desktop 4). */
+ val xs: Dp = 4.dp
+ /** Small fills and thumbnails (desktop 6). */
+ val sm: Dp = 6.dp
+ /** Tertiary-fill fields and rows (`tertiarySystemFill` boxes, desktop 8). */
+ val fill: Dp = 8.dp
+ /** Inline controls and trays (desktop 8). */
+ val control: Dp = 8.dp
+ /** Cards and glass cards (server list, error report, desktop 10). */
+ val card: Dp = 10.dp
+ /** Attachment chips, clipped media, settings tiles (desktop 10). */
+ val tile: Dp = 10.dp
+ /** Large panels: connect, server details, What's New cards (desktop dock 12). */
+ val panel: Dp = 12.dp
+ /** Sheets, scanner frame, model list, voice panel (16). */
+ val sheet: Dp = 16.dp
}
-/** Shapes for the iOS forms: capsules and circles stay capsules and circles. */
+/**
+ * Shapes for the iOS forms. [capsule] and [circle] stay true capsules and circles (grabbers,
+ * dots, avatars); controls that iOS draws as glass capsules use [control], the desktop's small
+ * rounded rectangle.
+ */
object OpenCodeShape {
val capsule = RoundedCornerShape(percent = 50)
+
+ /** Buttons, pills and fields (desktop `--radius-md`/`-lg` at phone size). */
+ val control = RoundedCornerShape(OpenCodeRadius.fill)
val circle = CircleShape
val card = RoundedCornerShape(OpenCodeRadius.card)
val panel = RoundedCornerShape(OpenCodeRadius.panel)
@@ -46,12 +53,13 @@ object OpenCodeShape {
}
/**
- * Material shape scale from the iOS radii: extraSmall 6, small 10, medium 14, large 20,
- * extraLarge 28. Material components read these (menus small, cards medium, dialogs and
+ * Material shape scale from the desktop radii: extraSmall 6, small 6, medium 8, large 10,
+ * extraLarge 16. Material components read these (text fields and menus extraSmall, dialogs and
* sheets extraLarge).
*/
val OpenCodeShapes = Shapes(
- extraSmall = RoundedCornerShape(OpenCodeRadius.xs),
+ // Text fields and menus: the desktop's 6 px input and context-menu radius.
+ extraSmall = RoundedCornerShape(OpenCodeRadius.sm),
small = RoundedCornerShape(OpenCodeRadius.sm),
medium = RoundedCornerShape(OpenCodeRadius.fill),
large = RoundedCornerShape(OpenCodeRadius.card),
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeSurfaces.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeSurfaces.kt
new file mode 100644
index 000000000..cf16fc612
--- /dev/null
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeSurfaces.kt
@@ -0,0 +1,144 @@
+package ai.opencode.core.ui
+
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.border
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.ProvideTextStyle
+import androidx.compose.material3.SwitchColors
+import androidx.compose.material3.SwitchDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.ReadOnlyComposable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.window.DialogProperties
+
+/**
+ * The OpenCode desktop's floating surfaces (`packages/ui` popover, dialog, dock:
+ * `--surface-raised-stronger-non-alpha`): a flat fill a step off the canvas, a hairline ring and,
+ * for things that float over content, a small shadow. No tonal elevation.
+ *
+ * Material components pick most of this up from the theme ([toColorScheme] maps
+ * `surfaceContainerLow`/`surfaceContainer` here for the curated themes, so bottom sheets, menus
+ * and tooltips are floating surfaces); call sites use these for what Material can't express
+ * (borders, the dialog's fill).
+ */
+object OpenCodeSurfaces {
+ /** Dialogs and popovers (desktop dialog ~10–12 px). */
+ val dialogShape: Shape = RoundedCornerShape(OpenCodeRadius.panel)
+
+ /** Popovers, menus and floating panels. */
+ val popoverShape: Shape = RoundedCornerShape(OpenCodeRadius.card)
+
+ /** The hairline every floating surface wears. */
+ val hairline: Dp = 1.dp
+
+ /** A small shadow under surfaces that float over content (desktop `--v2-elevation-raised`). */
+ val raisedShadow: Dp = 1.5.dp
+
+ /** Popovers and menus (desktop `--shadow-md`). */
+ val popoverShadow: Dp = 4.dp
+
+ /** The floating surface's fill: white in light, a step above the canvas in dark. */
+ val color: Color
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.floating
+
+ /**
+ * Neutral and secondary buttons' fill: a light grey that reads as a button on the canvas in
+ * both modes (`surfaceContainerHighest`, the brand's `surfaceStrong` `#EEEEEE` / `#3A3A3A`;
+ * labels 15.6:1 / 9.9:1). Worn with the hairline.
+ */
+ val neutralFill: Color
+ @Composable @ReadOnlyComposable get() = MaterialTheme.colorScheme.surfaceContainerHighest
+
+ /**
+ * Copy-command and terminal boxes, clearly set off from the canvas: the desktop's
+ * `--v2-background-bg-layer-03` in light (`#EEEEEE`) and its shell block's `bg-layer-02` in
+ * dark (`#2E2E2E`). Text on it is 15.6:1 / 11.6:1.
+ */
+ val commandFill: Color
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.let { if (it.isDark) it.userBubble else it.variant.surfaceStrong.color }
+
+ /** The floating surface's hairline. */
+ val border: BorderStroke
+ @Composable @ReadOnlyComposable get() = BorderStroke(hairline, OpenCodeTheme.colors.border)
+}
+
+/**
+ * The floating fill for these colours: the canvas in light (desktop popovers are white), a raised
+ * step above the canvas in dark ([darkFloatingFill]). The System theme keeps its code band.
+ */
+val OpenCodeColors.floating: Color
+ get() = when {
+ !isDark -> canvas
+ theme == AppTheme.System -> codeBand.copy(alpha = 1f)
+ else -> variant.darkFloatingFill().color
+ }
+
+/**
+ * Dark floating fill: the code band lifted about a third of the way to the user bubble (brand
+ * `#1C1C1C` → `#222222` on the `#161616` canvas), so the composer, request cards, menus and
+ * panels read as raised, as the desktop's `#1C1C1C` does over its `#101010` background.
+ */
+internal fun ThemeVariant.darkFloatingFill(): ThemeRGBA =
+ codeBand.composited(canvas).mixedInOklab(userBubble.composited(canvas), 0.35)
+
+/** A hairline ring in [shape] (desktop `0 0 0 1px border-base`). */
+@Composable
+fun Modifier.openCodeHairline(shape: Shape): Modifier =
+ border(OpenCodeSurfaces.hairline, OpenCodeTheme.colors.border, shape)
+
+/**
+ * Material's [AlertDialog] as the desktop's dialog: floating fill, hairline ring, 12 dp corners,
+ * no tonal elevation, a 16 sp medium title and 14 sp body. Semantics, buttons and dismissal are
+ * Material's, unchanged.
+ */
+@Composable
+fun OpenCodeAlertDialog(
+ onDismissRequest: () -> Unit,
+ confirmButton: @Composable () -> Unit,
+ modifier: Modifier = Modifier,
+ dismissButton: (@Composable () -> Unit)? = null,
+ icon: (@Composable () -> Unit)? = null,
+ title: (@Composable () -> Unit)? = null,
+ text: (@Composable () -> Unit)? = null,
+ properties: DialogProperties = DialogProperties(),
+) {
+ val shape = OpenCodeSurfaces.dialogShape
+ AlertDialog(
+ onDismissRequest = onDismissRequest,
+ confirmButton = confirmButton,
+ modifier = modifier.openCodeHairline(shape),
+ dismissButton = dismissButton,
+ icon = icon,
+ title = title?.let { content -> { ProvideTextStyle(OpenCodeTextStyles.headline) { content() } } },
+ text = text?.let { content -> { ProvideTextStyle(OpenCodeTextStyles.subheadline) { content() } } },
+ shape = shape,
+ containerColor = OpenCodeSurfaces.color,
+ tonalElevation = 0.dp,
+ properties = properties,
+ )
+}
+
+/**
+ * Switch colours for the curated themes. Material draws an off switch's border and thumb in
+ * `outline` (the desktop's `border-strong`, under 2:1 on cards); here they are [OpenCodeColors.tertiaryText],
+ * at least 3:1 against every surface a switch sits on and its own track (WCAG 1.4.11): light
+ * `#6E6E6E` 4.4–5.1:1, dark `#8A8A8A` 3.3–5.2:1. The System theme keeps Material's colours.
+ */
+object OpenCodeSwitchDefaults {
+ @Composable
+ fun colors(): SwitchColors {
+ val colors = OpenCodeTheme.colors
+ if (colors.theme == AppTheme.System) return SwitchDefaults.colors()
+ return SwitchDefaults.colors(
+ uncheckedThumbColor = colors.tertiaryText,
+ uncheckedBorderColor = colors.tertiaryText,
+ uncheckedIconColor = MaterialTheme.colorScheme.surfaceContainerHighest,
+ )
+ }
+}
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTextField.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTextField.kt
new file mode 100644
index 000000000..deb483c43
--- /dev/null
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTextField.kt
@@ -0,0 +1,389 @@
+package ai.opencode.core.ui
+
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.animation.core.animateDpAsState
+import androidx.compose.animation.core.tween
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.interaction.collectIsFocusedAsState
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.text.BasicTextField
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.ReadOnlyComposable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.alpha
+import androidx.compose.ui.draw.shadow
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.SolidColor
+import androidx.compose.ui.graphics.lerp
+import androidx.compose.ui.semantics.error
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.TextFieldValue
+import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+
+/**
+ * The desktop's text input (`packages/ui` `forms/text-input`) at touch size: a 48 dp field with
+ * 8 dp corners, the page's own fill (a step up in dark) and a hairline edge, a 1.5 dp accent
+ * ring while focused, the danger colour when [isError], half opacity when disabled. The label
+ * sits above the field rather than floating inside it, and the placeholder shows whenever the
+ * field is empty.
+ *
+ * A drop-in for Material's `OutlinedTextField` built on [BasicTextField]: the label, placeholder
+ * and supporting text are part of the field's decoration, so TalkBack reads them with it as it
+ * does Material's, and IME, selection and autofill behave the same.
+ */
+@Composable
+fun OpenCodeTextField(
+ value: String,
+ onValueChange: (String) -> Unit,
+ modifier: Modifier = Modifier,
+ label: String? = null,
+ placeholder: String? = null,
+ enabled: Boolean = true,
+ readOnly: Boolean = false,
+ isError: Boolean = false,
+ supportingText: String? = null,
+ leadingIcon: (@Composable () -> Unit)? = null,
+ trailingIcon: (@Composable () -> Unit)? = null,
+ textStyle: TextStyle = OpenCodeTextFieldDefaults.textStyle,
+ singleLine: Boolean = false,
+ minLines: Int = 1,
+ maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
+ keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
+ keyboardActions: KeyboardActions = KeyboardActions.Default,
+ visualTransformation: VisualTransformation = VisualTransformation.None,
+ interactionSource: MutableInteractionSource? = null,
+) {
+ val source = interactionSource ?: remember { MutableInteractionSource() }
+ val colors = OpenCodeTextFieldDefaults.colors()
+ BasicTextField(
+ value = value,
+ onValueChange = onValueChange,
+ modifier = modifier.fieldErrorSemantics(isError, supportingText),
+ enabled = enabled,
+ readOnly = readOnly,
+ textStyle = textStyle.copy(color = colors.text),
+ cursorBrush = SolidColor(if (isError) colors.error else colors.cursor),
+ keyboardOptions = keyboardOptions,
+ keyboardActions = keyboardActions,
+ visualTransformation = visualTransformation,
+ interactionSource = source,
+ singleLine = singleLine,
+ minLines = minLines,
+ maxLines = maxLines,
+ decorationBox = { innerTextField ->
+ FieldDecoration(
+ innerTextField = innerTextField,
+ isEmpty = value.isEmpty(),
+ label = label,
+ placeholder = placeholder,
+ enabled = enabled,
+ isError = isError,
+ supportingText = supportingText,
+ leadingIcon = leadingIcon,
+ trailingIcon = trailingIcon,
+ singleLine = singleLine,
+ textStyle = textStyle,
+ interactionSource = source,
+ )
+ },
+ )
+}
+
+/** [OpenCodeTextField] for a [TextFieldValue] (caret and selection held by the caller). */
+@Composable
+fun OpenCodeTextField(
+ value: TextFieldValue,
+ onValueChange: (TextFieldValue) -> Unit,
+ modifier: Modifier = Modifier,
+ label: String? = null,
+ placeholder: String? = null,
+ enabled: Boolean = true,
+ readOnly: Boolean = false,
+ isError: Boolean = false,
+ supportingText: String? = null,
+ leadingIcon: (@Composable () -> Unit)? = null,
+ trailingIcon: (@Composable () -> Unit)? = null,
+ textStyle: TextStyle = OpenCodeTextFieldDefaults.textStyle,
+ singleLine: Boolean = false,
+ minLines: Int = 1,
+ maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
+ keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
+ keyboardActions: KeyboardActions = KeyboardActions.Default,
+ visualTransformation: VisualTransformation = VisualTransformation.None,
+ interactionSource: MutableInteractionSource? = null,
+) {
+ val source = interactionSource ?: remember { MutableInteractionSource() }
+ val colors = OpenCodeTextFieldDefaults.colors()
+ BasicTextField(
+ value = value,
+ onValueChange = onValueChange,
+ modifier = modifier.fieldErrorSemantics(isError, supportingText),
+ enabled = enabled,
+ readOnly = readOnly,
+ textStyle = textStyle.copy(color = colors.text),
+ cursorBrush = SolidColor(if (isError) colors.error else colors.cursor),
+ keyboardOptions = keyboardOptions,
+ keyboardActions = keyboardActions,
+ visualTransformation = visualTransformation,
+ interactionSource = source,
+ singleLine = singleLine,
+ minLines = minLines,
+ maxLines = maxLines,
+ decorationBox = { innerTextField ->
+ FieldDecoration(
+ innerTextField = innerTextField,
+ isEmpty = value.text.isEmpty(),
+ label = label,
+ placeholder = placeholder,
+ enabled = enabled,
+ isError = isError,
+ supportingText = supportingText,
+ leadingIcon = leadingIcon,
+ trailingIcon = trailingIcon,
+ singleLine = singleLine,
+ textStyle = textStyle,
+ interactionSource = source,
+ )
+ },
+ )
+}
+
+/**
+ * A search field in the same container as [OpenCodeTextField]: a muted magnifier leading, the
+ * placeholder as its prompt. The model pickers' custom search rows use [openCodeFieldContainer]
+ * for the same look.
+ */
+@Composable
+fun OpenCodeSearchField(
+ value: String,
+ onValueChange: (String) -> Unit,
+ placeholder: String,
+ modifier: Modifier = Modifier,
+ trailingIcon: (@Composable () -> Unit)? = null,
+ keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
+ keyboardActions: KeyboardActions = KeyboardActions.Default,
+) {
+ OpenCodeTextField(
+ value = value,
+ onValueChange = onValueChange,
+ modifier = modifier,
+ placeholder = placeholder,
+ leadingIcon = {
+ OpenCodeIcon(
+ SFSymbol.Magnifyingglass,
+ contentDescription = null,
+ size = OpenCodeTextFieldDefaults.iconSize,
+ tint = OpenCodeTextFieldDefaults.colors().icon,
+ )
+ },
+ trailingIcon = trailingIcon,
+ singleLine = true,
+ keyboardOptions = keyboardOptions,
+ keyboardActions = keyboardActions,
+ )
+}
+
+/**
+ * The field container on its own, for a custom field row (a search capsule with its own clear
+ * button): fill, hairline (or the focus / error ring), 8 dp corners, and the light-mode lift.
+ */
+@Composable
+fun Modifier.openCodeFieldContainer(
+ isFocused: Boolean,
+ isError: Boolean = false,
+ shape: Shape = OpenCodeTextFieldDefaults.shape,
+): Modifier {
+ val colors = OpenCodeTextFieldDefaults.colors()
+ val borderColor by animateColorAsState(
+ when {
+ isError -> colors.error
+ isFocused -> colors.focusedBorder
+ else -> colors.border
+ },
+ tween(FieldMetrics.ANIMATION_MILLIS),
+ label = "fieldBorder",
+ )
+ val borderWidth by animateDpAsState(
+ if (isFocused) FieldMetrics.focusedBorderWidth else FieldMetrics.borderWidth,
+ tween(FieldMetrics.ANIMATION_MILLIS),
+ label = "fieldBorderWidth",
+ )
+ var lift: Modifier = Modifier
+ if (colors.shadow != Color.Transparent && !isFocused && !isError) {
+ lift = Modifier.shadow(FieldMetrics.elevation, shape, clip = false, ambientColor = colors.shadow, spotColor = colors.shadow)
+ }
+ return this
+ .then(lift)
+ .background(colors.container, shape)
+ .border(borderWidth, borderColor, shape)
+}
+
+/** [OpenCodeTextField]'s geometry, type and colours. */
+object OpenCodeTextFieldDefaults {
+ val shape: Shape = OpenCodeShape.control
+ val minHeight: Dp = 48.dp
+ val horizontalPadding: Dp = 12.dp
+ val iconSize: Dp = 18.dp
+
+ val textStyle: TextStyle
+ @Composable @ReadOnlyComposable get() = OpenCodeTextStyles.callout
+
+ val labelStyle: TextStyle
+ @Composable @ReadOnlyComposable get() = OpenCodeTextStyles.footnote.copy(fontWeight = FontWeight.Medium)
+
+ @Composable
+ @ReadOnlyComposable
+ fun colors(): OpenCodeTextFieldColors {
+ val colors = OpenCodeTheme.colors
+ val scheme = MaterialTheme.colorScheme
+ // Light: the page's own white with the desktop's soft lift. Dark: a step up from the sheet.
+ val container = if (colors.isDark) {
+ lerp(scheme.surfaceContainerLow, scheme.surfaceContainerHigh, 0.5f)
+ } else {
+ scheme.surfaceContainerLowest
+ }
+ val border = if (colors.strongBorders) colors.tertiaryText else scheme.outline
+ val shadow = if (colors.isDark) Color.Transparent else Color.Black.copy(alpha = 0.25f)
+ return OpenCodeTextFieldColors(
+ container = container,
+ border = border,
+ focusedBorder = scheme.primary,
+ error = scheme.error,
+ text = colors.text,
+ label = colors.secondaryText,
+ placeholder = colors.tertiaryText,
+ icon = colors.tertiaryText,
+ cursor = scheme.primary,
+ shadow = shadow,
+ )
+ }
+}
+
+/** [OpenCodeTextField]'s resolved colours for the current theme and appearance. */
+class OpenCodeTextFieldColors(
+ val container: Color,
+ val border: Color,
+ val focusedBorder: Color,
+ val error: Color,
+ val text: Color,
+ val label: Color,
+ val placeholder: Color,
+ val icon: Color,
+ val cursor: Color,
+ /** The light-mode lift under an idle field; transparent in dark. */
+ val shadow: Color,
+)
+
+@Composable
+private fun FieldDecoration(
+ innerTextField: @Composable () -> Unit,
+ isEmpty: Boolean,
+ label: String?,
+ placeholder: String?,
+ enabled: Boolean,
+ isError: Boolean,
+ supportingText: String?,
+ leadingIcon: (@Composable () -> Unit)?,
+ trailingIcon: (@Composable () -> Unit)?,
+ singleLine: Boolean,
+ textStyle: TextStyle,
+ interactionSource: MutableInteractionSource,
+) {
+ val colors = OpenCodeTextFieldDefaults.colors()
+ val focused by interactionSource.collectIsFocusedAsState()
+ Column(
+ Modifier.alpha(if (enabled) 1f else FieldMetrics.DISABLED_ALPHA),
+ verticalArrangement = Arrangement.spacedBy(FieldMetrics.labelSpacing),
+ ) {
+ if (label != null) {
+ Text(label, style = OpenCodeTextFieldDefaults.labelStyle, color = colors.label)
+ }
+ val verticalPadding = if (singleLine) 0.dp else FieldMetrics.multilineVerticalPadding
+ Row(
+ Modifier
+ .fillMaxWidth()
+ .heightIn(min = OpenCodeTextFieldDefaults.minHeight)
+ .openCodeFieldContainer(isFocused = focused && enabled, isError = isError),
+ verticalAlignment = if (singleLine) Alignment.CenterVertically else Alignment.Top,
+ ) {
+ if (leadingIcon != null) {
+ Box(
+ Modifier
+ .heightIn(min = OpenCodeTextFieldDefaults.minHeight)
+ .padding(start = OpenCodeTextFieldDefaults.horizontalPadding, end = FieldMetrics.iconSpacing),
+ contentAlignment = Alignment.Center,
+ ) { leadingIcon() }
+ }
+ val start = if (leadingIcon != null) 0.dp else OpenCodeTextFieldDefaults.horizontalPadding
+ val end = if (trailingIcon != null) 0.dp else OpenCodeTextFieldDefaults.horizontalPadding
+ Box(
+ Modifier
+ .weight(1f)
+ .heightIn(min = OpenCodeTextFieldDefaults.minHeight)
+ .padding(start = start, end = end, top = verticalPadding, bottom = verticalPadding),
+ contentAlignment = if (singleLine) Alignment.CenterStart else Alignment.TopStart,
+ ) {
+ if (isEmpty && placeholder != null) {
+ Text(
+ placeholder,
+ style = textStyle,
+ color = colors.placeholder,
+ maxLines = if (singleLine) 1 else Int.MAX_VALUE,
+ )
+ }
+ innerTextField()
+ }
+ if (trailingIcon != null) {
+ Box(
+ Modifier.heightIn(min = OpenCodeTextFieldDefaults.minHeight),
+ contentAlignment = Alignment.Center,
+ ) { trailingIcon() }
+ }
+ }
+ if (supportingText != null) {
+ Text(
+ supportingText,
+ style = OpenCodeTextStyles.footnote,
+ color = if (isError) colors.error else colors.label,
+ )
+ }
+ }
+}
+
+/** Material's error semantics: TalkBack announces the error with the field. */
+private fun Modifier.fieldErrorSemantics(isError: Boolean, supportingText: String?): Modifier {
+ if (!isError) return this
+ return semantics { error(supportingText ?: FieldMetrics.DEFAULT_ERROR) }
+}
+
+private object FieldMetrics {
+ val borderWidth: Dp = 1.dp
+ val focusedBorderWidth: Dp = 1.5.dp
+ val elevation: Dp = 1.dp
+ val labelSpacing: Dp = 6.dp
+ val iconSpacing: Dp = 8.dp
+ val multilineVerticalPadding: Dp = 13.dp
+ const val ANIMATION_MILLIS = 120
+ const val DISABLED_ALPHA = 0.5f
+ const val DEFAULT_ERROR = "Invalid input"
+}
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTheme.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTheme.kt
index 3b0716b34..dd3c83ce2 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTheme.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTheme.kt
@@ -7,6 +7,10 @@ import android.app.Activity
import android.app.UiModeManager
import android.content.Context
import android.content.ContextWrapper
+import android.database.ContentObserver
+import android.os.Handler
+import android.os.Looper
+import android.provider.Settings
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
@@ -21,6 +25,7 @@ import androidx.compose.runtime.State
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalConfiguration
@@ -49,6 +54,7 @@ fun OpenCodeTheme(
theme: AppTheme = AppTheme.System,
appearance: AppearanceColorScheme = AppearanceColorScheme.System,
highContrast: Boolean = rememberHighContrast(),
+ strongBorders: Boolean = highContrast || rememberHighContrastText(),
reduceMotion: Boolean = rememberReduceMotion(),
content: @Composable () -> Unit,
) {
@@ -59,11 +65,11 @@ fun OpenCodeTheme(
val dynamicScheme: ColorScheme? = remember(theme, isDark, context, configuration) {
if (theme == AppTheme.System) DynamicSystemTheme.colorScheme(context, isDark) else null
}
- val colors = remember(theme, isDark, highContrast, dynamicScheme) {
+ val colors = remember(theme, isDark, highContrast, strongBorders, dynamicScheme) {
if (dynamicScheme != null) {
- DynamicSystemTheme.colors(dynamicScheme, isDark, highContrast)
+ DynamicSystemTheme.colors(dynamicScheme, isDark, highContrast, strongBorders)
} else {
- OpenCodeColors.resolve(theme, isDark, highContrast)
+ OpenCodeColors.resolve(theme, isDark, highContrast, strongBorders)
}
}
val colorScheme = remember(colors, dynamicScheme) { dynamicScheme ?: colors.toColorScheme() }
@@ -152,6 +158,28 @@ fun rememberHighContrast(): Boolean {
private const val HIGH_CONTRAST_THRESHOLD = 0.5f
+/**
+ * Android's High contrast text accessibility setting (`Settings.Secure`
+ * `high_text_contrast_enabled`), live-updating. Only hairlines follow it ([OpenCodeColors.strongBorders]).
+ */
+@Composable
+fun rememberHighContrastText(): Boolean {
+ val context = LocalContext.current
+ val resolver = context.contentResolver
+ fun read() = Settings.Secure.getInt(resolver, HIGH_TEXT_CONTRAST, 0) == 1
+ var enabled by remember(resolver) { mutableStateOf(read()) }
+ DisposableEffect(resolver) {
+ val observer = object : ContentObserver(Handler(Looper.getMainLooper())) {
+ override fun onChange(selfChange: Boolean) { enabled = read() }
+ }
+ resolver.registerContentObserver(Settings.Secure.getUriFor(HIGH_TEXT_CONTRAST), false, observer)
+ onDispose { resolver.unregisterContentObserver(observer) }
+ }
+ return enabled
+}
+
+private const val HIGH_TEXT_CONTRAST = "high_text_contrast_enabled"
+
/** Accessors for the design system inside [OpenCodeTheme]. */
object OpenCodeTheme {
/** iOS semantic colours (`ThemePalette.*`). */
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTopBar.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTopBar.kt
new file mode 100644
index 000000000..c395920f9
--- /dev/null
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTopBar.kt
@@ -0,0 +1,238 @@
+package ai.opencode.core.ui
+
+import androidx.compose.animation.core.animateFloatAsState
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.RowScope
+import androidx.compose.foundation.layout.WindowInsets
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.windowInsetsPadding
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.LocalContentColor
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.ProvideTextStyle
+import androidx.compose.material3.Text
+import androidx.compose.material3.TopAppBarDefaults
+import androidx.compose.material3.TopAppBarScrollBehavior
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.derivedStateOf
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clipToBounds
+import androidx.compose.ui.draw.drawWithContent
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.layout.Layout
+import androidx.compose.ui.layout.layout
+import androidx.compose.ui.layout.onSizeChanged
+import androidx.compose.ui.semantics.clearAndSetSemantics
+import androidx.compose.ui.semantics.heading
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.Constraints
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import kotlin.math.max
+import kotlin.math.roundToInt
+
+/** Sizes of the desktop-style title bar ([OpenCodeTopBar], [OpenCodeLargeTopBar]). */
+object OpenCodeTopBarDefaults {
+ /** The bar's row: the session header's 52 dp (desktop 48 px), room for 48 dp controls. It grows with large text. */
+ val height: Dp = 52.dp
+
+ /** A start-aligned title's inset when there's no navigation control (desktop 16 px). */
+ val titleInset: Dp = 16.dp
+}
+
+/**
+ * The OpenCode desktop's title bar (`packages/app` settings and session headers): the pane's own
+ * canvas, a 16 sp medium title and plain icon controls, over a hairline instead of Material's
+ * tonal scrolled colour. Replaces Material's `TopAppBar`/`CenterAlignedTopAppBar`.
+ *
+ * Without a [scrollBehavior] the hairline always shows (the desktop's mobile settings bar). With
+ * one (Material's pinned behaviour) it fades in once content scrolls under the bar, on the
+ * theme's effects spring, as the session header's bar does.
+ *
+ * @param navigation the leading control (Back, or a Cancel/Done text button); 48 dp targets.
+ * @param centerTitle centre the title between the controls (iOS inline titles), else start-aligned.
+ * @param hairline false hides the hairline (a bar over a camera preview).
+ */
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun OpenCodeTopBar(
+ title: @Composable () -> Unit,
+ modifier: Modifier = Modifier,
+ navigation: @Composable () -> Unit = {},
+ actions: @Composable RowScope.() -> Unit = {},
+ centerTitle: Boolean = false,
+ scrollBehavior: TopAppBarScrollBehavior? = null,
+ containerColor: Color = OpenCodeTheme.colors.canvas,
+ contentColor: Color = OpenCodeTheme.colors.text,
+ hairline: Boolean = true,
+ windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
+) {
+ val overlapped by remember(scrollBehavior) {
+ derivedStateOf { scrollBehavior == null || scrollBehavior.state.overlappedFraction > 0.01f }
+ }
+ val lift by animateFloatAsState(
+ targetValue = if (hairline && overlapped) 1f else 0f,
+ animationSpec = MaterialTheme.motionScheme.defaultEffectsSpec(),
+ label = "top-bar-hairline",
+ )
+ val border = OpenCodeTheme.colors.border
+ Box(
+ modifier
+ .fillMaxWidth()
+ .background(containerColor)
+ .drawWithContent {
+ drawContent()
+ drawBottomHairline(border, lift)
+ }
+ .windowInsetsPadding(windowInsets),
+ ) {
+ TopBarRow(
+ title = title,
+ navigation = navigation,
+ actions = actions,
+ centerTitle = centerTitle,
+ contentColor = contentColor,
+ )
+ }
+}
+
+/**
+ * The desktop title bar with a large page title under it (Settings pages): the title (title1,
+ * 24 sp medium) scrolls up under the bar as the list scrolls, Material's exit-until-collapsed
+ * behaviour, and the bar's own title and hairline fade in as it goes. Replaces Material 3
+ * Expressive's `LargeFlexibleTopAppBar`; [scrollBehavior] must be
+ * `TopAppBarDefaults.exitUntilCollapsedScrollBehavior()`, connected to the page's nested scroll.
+ */
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun OpenCodeLargeTopBar(
+ title: String,
+ scrollBehavior: TopAppBarScrollBehavior,
+ modifier: Modifier = Modifier,
+ navigation: @Composable () -> Unit = {},
+ actions: @Composable RowScope.() -> Unit = {},
+ containerColor: Color = OpenCodeTheme.colors.canvas,
+ contentColor: Color = OpenCodeTheme.colors.text,
+ windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
+) {
+ val state = scrollBehavior.state
+ // TalkBack reads whichever copy of the title is showing (Material's large bars do the same).
+ val collapsed by remember(state) { derivedStateOf { state.collapsedFraction >= 0.5f } }
+ val border = OpenCodeTheme.colors.border
+ Column(
+ modifier
+ .fillMaxWidth()
+ .background(containerColor)
+ .drawWithContent {
+ drawContent()
+ drawBottomHairline(border, state.collapsedFraction)
+ }
+ .windowInsetsPadding(windowInsets),
+ ) {
+ TopBarRow(
+ title = {
+ Text(
+ title,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier
+ .graphicsLayer { alpha = ((state.collapsedFraction - 0.5f) * 2f).coerceIn(0f, 1f) }
+ .then(if (collapsed) Modifier.semantics { heading() } else Modifier.clearAndSetSemantics {}),
+ )
+ },
+ navigation = navigation,
+ actions = actions,
+ centerTitle = false,
+ contentColor = contentColor,
+ )
+ Box(
+ Modifier
+ .fillMaxWidth()
+ .clipToBounds()
+ .layout { measurable, constraints ->
+ val placeable = measurable.measure(constraints.copy(minHeight = 0, maxHeight = Constraints.Infinity))
+ val height = (placeable.height + state.heightOffset).roundToInt().coerceIn(0, placeable.height)
+ layout(placeable.width, height) { placeable.place(0, height - placeable.height) }
+ },
+ ) {
+ Text(
+ title,
+ style = OpenCodeTextStyles.title1,
+ color = contentColor,
+ modifier = Modifier
+ .fillMaxWidth()
+ // The title's full height is how far the bar collapses.
+ .onSizeChanged { state.heightOffsetLimit = -it.height.toFloat() }
+ .padding(start = OpenCodeTopBarDefaults.titleInset, end = OpenCodeTopBarDefaults.titleInset, top = 4.dp, bottom = 12.dp)
+ .graphicsLayer { alpha = 1f - state.collapsedFraction }
+ .then(if (collapsed) Modifier.clearAndSetSemantics {} else Modifier.semantics { heading() }),
+ )
+ }
+ }
+}
+
+/** The title bar's Back control: a plain chevron with a 48 dp target. */
+@Composable
+fun OpenCodeTopBarBackButton(onClick: () -> Unit, modifier: Modifier = Modifier) {
+ OpenCodeIconButton(SFSymbol.ChevronBackward, contentDescription = "Back", onClick = onClick, modifier = modifier, style = OpenCodeIconButtonStyle.Standard)
+}
+
+/** The bar's row: navigation, title, actions, at least [OpenCodeTopBarDefaults.height] tall. */
+@Composable
+private fun TopBarRow(
+ title: @Composable () -> Unit,
+ navigation: @Composable () -> Unit,
+ actions: @Composable RowScope.() -> Unit,
+ centerTitle: Boolean,
+ contentColor: Color,
+) {
+ CompositionLocalProvider(LocalContentColor provides contentColor) {
+ Layout(
+ contents = listOf(
+ { Box(Modifier.padding(start = 4.dp)) { navigation() } },
+ { ProvideTextStyle(OpenCodeTextStyles.headline.copy(color = contentColor)) { title() } },
+ { Row(Modifier.padding(end = 4.dp)) { actions() } },
+ ),
+ modifier = Modifier.fillMaxWidth().heightIn(min = OpenCodeTopBarDefaults.height),
+ ) { (navigationMeasurables, titleMeasurables, actionMeasurables), constraints ->
+ val loose = constraints.copy(minWidth = 0, minHeight = 0)
+ val nav = navigationMeasurables.first().measure(loose)
+ val action = actionMeasurables.first().measure(loose)
+ val width = constraints.maxWidth
+ // A navigation control brings its own padding; a bare title starts at the desktop inset.
+ val navWidth = if (nav.width > 4.dp.roundToPx()) nav.width else OpenCodeTopBarDefaults.titleInset.roundToPx()
+ val gap = 4.dp.roundToPx()
+ val titleWidth = if (centerTitle) {
+ width - 2 * max(navWidth, action.width) - 2 * gap
+ } else {
+ width - navWidth - action.width - 2 * gap
+ }
+ val text = titleMeasurables.first().measure(loose.copy(maxWidth = max(titleWidth, 0)))
+ val height = max(constraints.minHeight, maxOf(nav.height, text.height, action.height))
+ layout(width, height) {
+ nav.place(0, (height - nav.height) / 2)
+ action.place(width - action.width, (height - action.height) / 2)
+ val x = if (centerTitle) (width - text.width) / 2 else navWidth + if (nav.width > 4.dp.roundToPx()) gap else 0
+ text.place(x, (height - text.height) / 2)
+ }
+ }
+ }
+}
+
+private fun androidx.compose.ui.graphics.drawscope.DrawScope.drawBottomHairline(color: Color, alpha: Float) {
+ if (alpha <= 0f) return
+ val px = OpenCodeSurfaces.hairline.toPx()
+ drawRect(color = color, topLeft = Offset(0f, size.height - px), size = Size(size.width, px), alpha = alpha.coerceIn(0f, 1f))
+}
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTypography.kt b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTypography.kt
index 58e9f46e3..f95565681 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTypography.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/OpenCodeTypography.kt
@@ -11,13 +11,41 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.sp
-/** Font families. Everything is the system sans (Roboto / the device font); iOS uses SF. */
+/**
+ * Font families. This branch uses the OpenCode desktop's fonts: Inter (variable) for UI text and
+ * IBM Plex Mono for code and tool output (`packages/ui` `--font-family-sans` / `-mono`). Both are
+ * OFL-1.1 (`docs/licenses/`).
+ */
object OpenCodeFonts {
- /** The platform sans-serif, the Android counterpart of SF Pro. */
- val system: FontFamily = FontFamily.Default
+ /**
+ * Inter at the desktop's weights: Normal → 440 (`--font-weight-regular`), Medium → 530
+ * (`--font-weight-medium`), SemiBold → 600, Bold → 670 (`--font-weight-bold`).
+ */
+ @OptIn(ExperimentalTextApi::class)
+ val system: FontFamily = FontFamily(
+ listOf(
+ FontWeight.Light to 340,
+ FontWeight.Normal to 440,
+ FontWeight.Medium to 530,
+ FontWeight.SemiBold to 600,
+ FontWeight.Bold to 670,
+ FontWeight.ExtraBold to 760,
+ ).map { (weight, axis) ->
+ Font(
+ R.font.inter,
+ weight = weight,
+ variationSettings = FontVariation.Settings(FontVariation.weight(axis)),
+ )
+ },
+ )
- /** Monospace for code (iOS: SF Mono via `.monospaced()`). */
- val monospace: FontFamily = FontFamily.Monospace
+ /** IBM Plex Mono for code, tool output and paths (desktop `--font-family-mono`). */
+ val monospace: FontFamily = FontFamily(
+ Font(R.font.plex_mono_regular, FontWeight.Normal),
+ Font(R.font.plex_mono_medium, FontWeight.Medium),
+ Font(R.font.plex_mono_semibold, FontWeight.SemiBold),
+ Font(R.font.plex_mono_semibold, FontWeight.Bold),
+ )
/**
* Berkeley Mono (variable), only for onboarding's brand marks, exactly as iOS restricts
@@ -36,43 +64,46 @@ object OpenCodeFonts {
}
/**
- * iOS Dynamic Type text styles at the default size (Large), in sp. iOS points and Android
- * dp are within 2 % physically (163 vs 160 per inch), so the sizes port 1:1 and keep iOS's
- * relative scale; sp also follows the system font scale like Dynamic Type.
+ * The text styles under iOS's Dynamic Type names (so ported views still say `.footnote`), sized
+ * to the OpenCode desktop scale. sp follows the system font scale like Dynamic Type.
*
* Use these by name when porting a view that says `.font(.footnote)`; Material components
* pick them up through [OpenCodeTypography]'s role mapping.
*/
object OpenCodeTextStyles {
- private fun style(size: Int, lineHeight: Int, weight: FontWeight = FontWeight.Normal) = TextStyle(
+ private fun style(size: Int, lineHeight: Int, weight: FontWeight = FontWeight.Normal, tracking: Double = 0.0) = TextStyle(
fontFamily = OpenCodeFonts.system,
fontWeight = weight,
fontSize = size.sp,
lineHeight = lineHeight.sp,
- letterSpacing = TextUnit.Unspecified,
+ letterSpacing = if (tracking == 0.0) TextUnit.Unspecified else tracking.sp,
)
- /** `.largeTitle` 34/41. */
- val largeTitle = style(34, 41)
- /** `.title` (title1) 28/34. */
- val title1 = style(28, 34)
- /** `.title2` 22/28. */
- val title2 = style(22, 28)
- /** `.title3` 20/25. */
- val title3 = style(20, 25)
- /** `.headline` 17/22 semibold. */
- val headline = style(17, 22, FontWeight.SemiBold)
- /** `.body` 17/22. */
- val body = style(17, 22)
- /** `.callout` 16/21. */
- val callout = style(16, 21)
- /** `.subheadline` 15/20. */
- val subheadline = style(15, 20)
- /** `.footnote` 13/18. */
+ // The desktop scale (13/14/16/20 px at weights 440/530/670) stretched for a phone held
+ // closer than a monitor: body text one step up (15 sp), titles medium-weight and tightly
+ // tracked like the desktop's `text-16/20-medium`. Everything stays in sp, so font scaling works.
+
+ /** `.largeTitle`: 28/34 medium. */
+ val largeTitle = style(28, 34, FontWeight.Medium, -0.4)
+ /** `.title` (title1): 24/30 medium. */
+ val title1 = style(24, 30, FontWeight.Medium, -0.32)
+ /** `.title2`: 20/26 medium (desktop `text-20-medium`). */
+ val title2 = style(20, 26, FontWeight.Medium, -0.32)
+ /** `.title3`: 18/24 medium. */
+ val title3 = style(18, 24, FontWeight.Medium, -0.16)
+ /** `.headline`: 16/22 medium (desktop `text-16-medium`). */
+ val headline = style(16, 22, FontWeight.Medium, -0.16)
+ /** `.body`: 15/23 (desktop markdown 14 px / 160 %). */
+ val body = style(15, 23)
+ /** `.callout`: 15/21. */
+ val callout = style(15, 21)
+ /** `.subheadline`: 14/20 (desktop `text-14`). */
+ val subheadline = style(14, 20)
+ /** `.footnote`: 13/18 (desktop `text-12`, 13 px). */
val footnote = style(13, 18)
- /** `.caption` (caption1) 12/16. */
+ /** `.caption` (caption1): 12/16. */
val caption1 = style(12, 16)
- /** `.caption2` 11/13. */
+ /** `.caption2`: 11/13. */
val caption2 = style(11, 13)
}
@@ -104,11 +135,11 @@ val OpenCodeTypography: Typography = with(OpenCodeTextStyles) {
headlineSmall = title3,
titleLarge = title3,
titleMedium = headline,
- titleSmall = subheadline.copy(fontWeight = FontWeight.SemiBold),
+ titleSmall = subheadline.copy(fontWeight = FontWeight.Medium),
bodyLarge = body,
bodyMedium = subheadline,
bodySmall = footnote,
- labelLarge = body.copy(fontWeight = FontWeight.SemiBold),
+ labelLarge = subheadline.copy(fontWeight = FontWeight.Medium),
labelMedium = caption1.copy(fontWeight = FontWeight.Medium),
labelSmall = caption2.copy(fontWeight = FontWeight.Medium),
)
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/TapTarget.kt b/core/src/main/kotlin/ai/opencode/core/ui/TapTarget.kt
index b81df4322..1ec317f4d 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/TapTarget.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/TapTarget.kt
@@ -1,7 +1,9 @@
package ai.opencode.core.ui
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.material3.OutlinedIconButton
import androidx.compose.foundation.layout.size
-import androidx.compose.material3.FilledTonalIconButton
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.MaterialTheme
@@ -62,7 +64,11 @@ enum class OpenCodeIconButtonStyle {
/** Bare glyph (toolbar icons; iOS plain buttons inside a shared glass bar). */
Standard,
- /** Tonal circle (iOS `openCodeGlassCircle`: a standalone round glass control). */
+ /**
+ * A standalone control (iOS `openCodeGlassCircle`). On this branch it is the desktop's
+ * neutral icon button: a rounded square on the base surface with a hairline ring, or a
+ * filled rounded square when tinted. The name is kept so call sites match iOS.
+ */
Circle,
}
@@ -95,16 +101,17 @@ fun OpenCodeIconButton(
OpenCodeIcon(symbol, contentDescription = contentDescription, size = iconSize)
}
OpenCodeIconButtonStyle.Circle -> {
- val container = tint ?: MaterialTheme.colorScheme.surfaceContainerHighest
- FilledTonalIconButton(
+ val container = tint ?: OpenCodeSurfaces.neutralFill
+ OutlinedIconButton(
onClick = onClick,
modifier = face,
enabled = enabled,
- shape = OpenCodeShape.circle,
- colors = IconButtonDefaults.filledTonalIconButtonColors(
+ shape = RoundedCornerShape(OpenCodeRadius.card),
+ colors = IconButtonDefaults.outlinedIconButtonColors(
containerColor = container,
contentColor = tint?.highContrastForeground() ?: OpenCodeTheme.colors.text,
),
+ border = if (tint == null) BorderStroke(1.dp, OpenCodeTheme.colors.border) else null,
) {
OpenCodeIcon(symbol, contentDescription = contentDescription, size = iconSize)
}
diff --git a/core/src/main/kotlin/ai/opencode/core/ui/ThemeSharedKeys.kt b/core/src/main/kotlin/ai/opencode/core/ui/ThemeSharedKeys.kt
index f75ff0360..27884f47d 100644
--- a/core/src/main/kotlin/ai/opencode/core/ui/ThemeSharedKeys.kt
+++ b/core/src/main/kotlin/ai/opencode/core/ui/ThemeSharedKeys.kt
@@ -10,8 +10,8 @@ import ai.opencode.core.sharing.SharedKey
* mutate only from the Settings reducer, and only when the value changes.
*/
object ThemeSharedKeys {
- /** The chosen theme; [AppTheme.System] by default. */
- val appTheme = SharedKey.appStorage("appearance-theme", AppTheme.System)
+ /** The chosen theme; [AppTheme.OpenCode] (the desktop brand palette) by default on this branch. */
+ val appTheme = SharedKey.appStorage("appearance-theme", AppTheme.OpenCode)
/** System / Light / Dark override; [AppearanceColorScheme.System] by default. */
val appearanceColorScheme = SharedKey.appStorage("appearance-color-scheme", AppearanceColorScheme.System)
diff --git a/core/src/main/res/font/inter.ttf b/core/src/main/res/font/inter.ttf
new file mode 100644
index 000000000..e31b51e3e
Binary files /dev/null and b/core/src/main/res/font/inter.ttf differ
diff --git a/core/src/main/res/font/plex_mono_medium.ttf b/core/src/main/res/font/plex_mono_medium.ttf
new file mode 100644
index 000000000..33c546f68
Binary files /dev/null and b/core/src/main/res/font/plex_mono_medium.ttf differ
diff --git a/core/src/main/res/font/plex_mono_regular.ttf b/core/src/main/res/font/plex_mono_regular.ttf
new file mode 100644
index 000000000..0c9770d51
Binary files /dev/null and b/core/src/main/res/font/plex_mono_regular.ttf differ
diff --git a/core/src/main/res/font/plex_mono_semibold.ttf b/core/src/main/res/font/plex_mono_semibold.ttf
new file mode 100644
index 000000000..8f8998a13
Binary files /dev/null and b/core/src/main/res/font/plex_mono_semibold.ttf differ
diff --git a/core/src/test/kotlin/ai/opencode/core/ui/ThemePaletteTests.kt b/core/src/test/kotlin/ai/opencode/core/ui/ThemePaletteTests.kt
index 14921dd65..afe572e13 100644
--- a/core/src/test/kotlin/ai/opencode/core/ui/ThemePaletteTests.kt
+++ b/core/src/test/kotlin/ai/opencode/core/ui/ThemePaletteTests.kt
@@ -84,9 +84,17 @@ class ThemePaletteTests {
if (theme == AppTheme.System) continue
val def = ThemePalette.definition(theme)
- // Dark swatch accent dot sits at L ~= 0.78; light swatch accent dot sits at L ~= 0.52.
- assertTrue("${theme.title} dark swatchAccent L=${def.dark.swatchAccent.oklch.first}", abs(def.dark.swatchAccent.oklch.first - 0.78) < 0.015)
- assertTrue("${theme.title} light swatchAccent L=${def.light.swatchAccent.oklch.first}", abs(def.light.swatchAccent.oklch.first - 0.52) < 0.015)
+ if (theme == AppTheme.OpenCode) {
+ // Android diverges from iOS on purpose here: the OpenCode theme is the desktop's
+ // palette (BrandPalette), whose accent is the monochrome contrast fill, so its
+ // swatch dot is near-black in light and near-white in dark.
+ assertTrue("${theme.title} dark swatchAccent L=${def.dark.swatchAccent.oklch.first}", def.dark.swatchAccent.oklch.first > 0.85)
+ assertTrue("${theme.title} light swatchAccent L=${def.light.swatchAccent.oklch.first}", def.light.swatchAccent.oklch.first < 0.35)
+ } else {
+ // Dark swatch accent dot sits at L ~= 0.78; light swatch accent dot sits at L ~= 0.52.
+ assertTrue("${theme.title} dark swatchAccent L=${def.dark.swatchAccent.oklch.first}", abs(def.dark.swatchAccent.oklch.first - 0.78) < 0.015)
+ assertTrue("${theme.title} light swatchAccent L=${def.light.swatchAccent.oklch.first}", abs(def.light.swatchAccent.oklch.first - 0.52) < 0.015)
+ }
// Swatch ring maintains a crisp perceptual lightness step from swatchCanvas, and the
// three ThemeSwatchTile palette dots (swatchCanvas, swatchAccent, syntaxKeyword) are distinct.
diff --git a/devtools/src/main/kotlin/ai/opencode/devtools/DevToolsView.kt b/devtools/src/main/kotlin/ai/opencode/devtools/DevToolsView.kt
index 5872e0c62..efd04fd7b 100644
--- a/devtools/src/main/kotlin/ai/opencode/devtools/DevToolsView.kt
+++ b/devtools/src/main/kotlin/ai/opencode/devtools/DevToolsView.kt
@@ -1,12 +1,17 @@
package ai.opencode.devtools
+import ai.opencode.core.ui.OpenCodeIconButtonStyle
+import ai.opencode.core.ui.OpenCodeIconButton
import ai.opencode.core.diagnostics.DiagnosticsEvent
import ai.opencode.core.diagnostics.MotionWatchEvent
import ai.opencode.core.store.StoreOf
import ai.opencode.core.store.collectState
import ai.opencode.core.tuning.AnimationTimeScale
import ai.opencode.core.ui.OpenCodeIcon
+import ai.opencode.core.ui.OpenCodeSwitchDefaults
import ai.opencode.core.ui.OpenCodeTheme
+import ai.opencode.core.ui.OpenCodeTopBar
+import ai.opencode.core.ui.OpenCodeTopBarBackButton
import ai.opencode.core.ui.SFSymbol
import ai.opencode.devtools.perf.TimeScaleLabel
import androidx.activity.compose.BackHandler
@@ -16,13 +21,13 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.items
@@ -33,7 +38,6 @@ import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FilterChip
import androidx.compose.material3.HorizontalDivider
-import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
@@ -43,7 +47,6 @@ import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
-import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -98,11 +101,11 @@ fun DevToolsView(
Scaffold(
modifier = modifier,
topBar = {
- TopAppBar(
+ OpenCodeTopBar(
title = { Text(title, Modifier.semantics { heading() }) },
- navigationIcon = {
+ navigation = {
val back = if (state.route != DevToolsFeature.Route.Main) ({ send(DevToolsFeature.Action.BackTapped) }) else onClose
- if (back != null) IconButton(onClick = back) { OpenCodeIcon(SFSymbol.ChevronBackward, "Back") }
+ if (back != null) OpenCodeTopBarBackButton(onClick = back)
},
actions = { Actions(state, send) },
)
@@ -134,20 +137,25 @@ private fun Actions(state: DevToolsFeature.State, send: (DevToolsFeature.Action)
DevToolsFeature.Route.Troubleshooting, DevToolsFeature.Route.Network -> {
var menu by remember { mutableStateOf(false) }
Box {
- IconButton(onClick = { menu = true }, enabled = state.events.isNotEmpty()) { OpenCodeIcon(SFSymbol.SquareAndArrowUp, "Share") }
+ OpenCodeIconButton(SFSymbol.SquareAndArrowUp, "Share", onClick = { menu = true }, style = OpenCodeIconButtonStyle.Standard, enabled = state.events.isNotEmpty())
DropdownMenu(menu, onDismissRequest = { menu = false }) {
DropdownMenuItem(text = { Text("Text") }, onClick = { menu = false; send(DevToolsFeature.Action.ShareTimelineTapped(json = false)) })
DropdownMenuItem(text = { Text("JSON") }, onClick = { menu = false; send(DevToolsFeature.Action.ShareTimelineTapped(json = true)) })
}
}
- IconButton(onClick = { send(DevToolsFeature.Action.ClearTapped) }, enabled = state.events.isNotEmpty() || state.motionJumps.isNotEmpty()) {
- OpenCodeIcon(SFSymbol.Trash, "Clear", tint = MaterialTheme.colorScheme.error)
- }
+ OpenCodeIconButton(
+ SFSymbol.Trash,
+ "Clear",
+ onClick = { send(DevToolsFeature.Action.ClearTapped) },
+ style = OpenCodeIconButtonStyle.Standard,
+ tint = MaterialTheme.colorScheme.error,
+ enabled = state.events.isNotEmpty() || state.motionJumps.isNotEmpty(),
+ )
}
DevToolsFeature.Route.Logs -> {
- IconButton(onClick = { send(DevToolsFeature.Action.Reload) }) { OpenCodeIcon(SFSymbol.ArrowClockwise, "Refresh") }
- IconButton(onClick = { send(DevToolsFeature.Action.CopyLogTapped) }) { OpenCodeIcon(SFSymbol.DocOnDoc, "Copy") }
- IconButton(onClick = { send(DevToolsFeature.Action.ShareLogTapped) }) { OpenCodeIcon(SFSymbol.SquareAndArrowUp, "Share") }
+ OpenCodeIconButton(SFSymbol.ArrowClockwise, "Refresh", onClick = { send(DevToolsFeature.Action.Reload) }, style = OpenCodeIconButtonStyle.Standard)
+ OpenCodeIconButton(SFSymbol.DocOnDoc, "Copy", onClick = { send(DevToolsFeature.Action.CopyLogTapped) }, style = OpenCodeIconButtonStyle.Standard)
+ OpenCodeIconButton(SFSymbol.SquareAndArrowUp, "Share", onClick = { send(DevToolsFeature.Action.ShareLogTapped) }, style = OpenCodeIconButtonStyle.Standard)
}
else -> Unit
}
@@ -306,7 +314,7 @@ private fun SwitchRow(
Text(title, style = MaterialTheme.typography.bodyLarge, color = if (enabled) MaterialTheme.colorScheme.onSurface else OpenCodeTheme.colors.secondaryText)
if (subtitle != null) Text(subtitle, style = MaterialTheme.typography.bodySmall, color = OpenCodeTheme.colors.secondaryText)
}
- Switch(checked = checked, onCheckedChange = null, enabled = enabled)
+ Switch(checked = checked, onCheckedChange = null, enabled = enabled, colors = OpenCodeSwitchDefaults.colors())
}
}
diff --git a/devtools/src/main/kotlin/ai/opencode/devtools/traces/ProblemReportSheet.kt b/devtools/src/main/kotlin/ai/opencode/devtools/traces/ProblemReportSheet.kt
index 7a5432e10..c609ce797 100644
--- a/devtools/src/main/kotlin/ai/opencode/devtools/traces/ProblemReportSheet.kt
+++ b/devtools/src/main/kotlin/ai/opencode/devtools/traces/ProblemReportSheet.kt
@@ -7,6 +7,9 @@ import ai.opencode.core.store.observe
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeIconSize
import ai.opencode.core.ui.OpenCodePrimaryButton
+import ai.opencode.core.ui.OpenCodeShape
+import ai.opencode.core.ui.OpenCodeSurfaces
+import ai.opencode.core.ui.OpenCodeSwitchDefaults
import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.core.ui.SFSymbol
@@ -18,7 +21,6 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.clickable
-import androidx.compose.foundation.selection.toggleable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -34,8 +36,8 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.selection.toggleable
import androidx.compose.foundation.shape.CircleShape
-import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.CircularProgressIndicator
@@ -157,7 +159,7 @@ private fun NoteField(note: String, enabled: Boolean, onChange: (String) -> Unit
minLines = 3,
maxLines = 6,
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences),
- shape = RoundedCornerShape(14.dp),
+ shape = OpenCodeShape.panel,
colors = TextFieldDefaults.colors(
focusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
unfocusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
@@ -173,8 +175,9 @@ private fun NoteField(note: String, enabled: Boolean, onChange: (String) -> Unit
@Composable
private fun ScreenshotToggle(isOn: Boolean, enabled: Boolean, onChange: (Boolean) -> Unit) {
Surface(
- shape = RoundedCornerShape(14.dp),
- color = MaterialTheme.colorScheme.surfaceContainerHighest,
+ shape = OpenCodeShape.panel,
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
modifier = Modifier.fillMaxWidth(),
) {
Row(
@@ -187,7 +190,7 @@ private fun ScreenshotToggle(isOn: Boolean, enabled: Boolean, onChange: (Boolean
verticalAlignment = Alignment.CenterVertically,
) {
Text("Include Screenshot", style = OpenCodeTextStyles.body, modifier = Modifier.weight(1f))
- Switch(checked = isOn, onCheckedChange = null, enabled = enabled)
+ Switch(checked = isOn, onCheckedChange = null, enabled = enabled, colors = OpenCodeSwitchDefaults.colors())
}
}
}
@@ -215,8 +218,9 @@ private fun Footer(report: State.Report, send: (Action) -> Unit) {
}
State.Report.Phase.Sent -> Surface(
- shape = RoundedCornerShape(14.dp),
- color = MaterialTheme.colorScheme.surfaceContainerHighest,
+ shape = OpenCodeShape.panel,
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
modifier = Modifier.fillMaxWidth().testTag("problem-report-sent"),
) {
Row(Modifier.padding(start = 14.dp), verticalAlignment = Alignment.CenterVertically) {
diff --git a/devtools/src/main/kotlin/ai/opencode/devtools/tuning/TuningPanel.kt b/devtools/src/main/kotlin/ai/opencode/devtools/tuning/TuningPanel.kt
index 3e7855db0..e25aafe32 100644
--- a/devtools/src/main/kotlin/ai/opencode/devtools/tuning/TuningPanel.kt
+++ b/devtools/src/main/kotlin/ai/opencode/devtools/tuning/TuningPanel.kt
@@ -5,13 +5,17 @@ import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.store.StoreOf
import ai.opencode.core.store.collectState
+import ai.opencode.core.tuning.TunableDescriptor
import ai.opencode.core.tuning.TuneKind
import ai.opencode.core.tuning.TuneValue
-import ai.opencode.core.tuning.TunableDescriptor
import ai.opencode.core.tuning.TuningStore
import ai.opencode.core.tuning.TuningTitle
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeIconSize
+import ai.opencode.core.ui.OpenCodeShape
+import ai.opencode.core.ui.OpenCodeSurfaces
+import ai.opencode.core.ui.OpenCodeSwitchDefaults
+import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.core.ui.SFSymbol
import ai.opencode.core.ui.openCodeTapTarget
@@ -28,7 +32,7 @@ import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
-import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
@@ -44,6 +48,7 @@ import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.imeAnimationTarget
import androidx.compose.foundation.layout.offset
@@ -53,19 +58,21 @@ import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
+import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.CircleShape
-import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.BasicText
+import androidx.compose.foundation.text.TextAutoSize
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.FilterChip
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
-import androidx.compose.foundation.text.BasicText
-import androidx.compose.foundation.text.TextAutoSize
-import androidx.compose.ui.unit.sp
+import androidx.compose.material3.SegmentedButton
+import androidx.compose.material3.SegmentedButtonDefaults
+import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderDefaults
import androidx.compose.material3.Surface
@@ -92,19 +99,12 @@ import androidx.compose.ui.input.pointer.util.VelocityTracker
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
-import androidx.compose.material3.SegmentedButton
-import androidx.compose.material3.SegmentedButtonDefaults
-import androidx.compose.material3.SingleChoiceSegmentedButtonRow
-import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.Role
-import androidx.compose.ui.semantics.selected
-import androidx.compose.foundation.layout.wrapContentHeight
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.background
-import ai.opencode.core.ui.OpenCodeTextStyles
+import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.selected
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.text.font.FontFamily
@@ -113,6 +113,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
import kotlin.math.PI
import kotlin.math.roundToInt
import kotlin.math.sqrt
@@ -412,10 +413,10 @@ private fun PanelForm(
val title = if (state.showsAll) "All" else tuning.context.displayTitle
Surface(
modifier = modifier.semantics { contentDescription = "Tuning Panel" },
- shape = RoundedCornerShape(20.dp),
- tonalElevation = 6.dp,
- shadowElevation = 8.dp,
- border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant),
+ shape = OpenCodeShape.panel,
+ color = OpenCodeSurfaces.color,
+ shadowElevation = 6.dp,
+ border = OpenCodeSurfaces.border,
) {
Column(Modifier.width(width).heightIn(max = maxHeight)) {
PanelHeader(store, state, title, changed, groups, drag)
@@ -516,10 +517,10 @@ private fun TuningPill(state: TuningFeature.State, expand: () -> Unit, modifier:
contentAlignment = Alignment.Center,
) {
Surface(
- shape = CircleShape,
- tonalElevation = 6.dp,
- shadowElevation = 8.dp,
- border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant),
+ shape = OpenCodeShape.control,
+ color = OpenCodeSurfaces.color,
+ shadowElevation = 6.dp,
+ border = OpenCodeSurfaces.border,
) {
Row(
Modifier.height(34.dp).padding(horizontal = 12.dp),
@@ -558,11 +559,10 @@ private fun TuningTab(side: TuningPlacement.Side, pullOut: () -> Unit, modifier:
) {
Surface(
modifier = Modifier.size(TuningPlacementLayout.TAB_GLASS_WIDTH.dp, TuningPlacementLayout.TabSize.height.dp),
- shape = CircleShape,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
- tonalElevation = 6.dp,
- shadowElevation = 8.dp,
- border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant),
+ shape = OpenCodeShape.control,
+ color = OpenCodeSurfaces.color,
+ shadowElevation = 6.dp,
+ border = OpenCodeSurfaces.border,
) {
Box(contentAlignment = Alignment.Center) {
OpenCodeIcon(
@@ -751,6 +751,7 @@ private fun TunableRow(descriptor: TunableDescriptor, override: TuneValue?, set:
checked = (current as? TuneValue.Bool)?.value ?: false,
onCheckedChange = { set(TuneValue.Bool(it)) },
modifier = Modifier.semantics { contentDescription = descriptor.label },
+ colors = OpenCodeSwitchDefaults.colors(),
)
if (isChanged) ValueText("Reset", true) { set(null) }
}
diff --git a/docs/licenses/IBMPlexMono-OFL.txt b/docs/licenses/IBMPlexMono-OFL.txt
new file mode 100644
index 000000000..c35c4c618
--- /dev/null
+++ b/docs/licenses/IBMPlexMono-OFL.txt
@@ -0,0 +1,93 @@
+Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+
+This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/docs/licenses/Inter-OFL.txt b/docs/licenses/Inter-OFL.txt
new file mode 100644
index 000000000..9b2ca37b3
--- /dev/null
+++ b/docs/licenses/Inter-OFL.txt
@@ -0,0 +1,92 @@
+Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION AND CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/docs/parity/core-ui.md b/docs/parity/core-ui.md
index 26b3505bc..3843b4fc0 100644
--- a/docs/parity/core-ui.md
+++ b/docs/parity/core-ui.md
@@ -6,13 +6,77 @@ files: `OpenCode/Core/Theme/`, `OpenCode/Core/Motion/`, `OpenCode/Core/RollingNu
[core.md](core.md).
Status values: `todo`, `partial: `, `done`, `n/a: `.
+
+**Visual divergence (on purpose):** behaviour, tokens' names and APIs port iOS, but the look is
+the OpenCode desktop design system (`packages/ui`, theme `oc-2`), not iOS's SF / Liquid Glass:
+
+- Fonts: Inter (variable; Normal 440, Medium 530, SemiBold 600, Bold 670) for UI text,
+ IBM Plex Mono for code, tool output and commands (`res/font`, OFL in `docs/licenses/`).
+ `OpenCodeTextStyles` keep the iOS names at the desktop's sizes (body 15, subheadline 14,
+ footnote 13, headline 16 medium, titles medium with tight tracking), all in sp.
+- Colour: `AppTheme.OpenCode` is `BrandPalette` (desktop v2 neutrals, monochrome contrast
+ accent, blue links; five light values darkened just enough for WCAG AA) and is the default
+ theme. Curated themes keep their palettes; System is Material You. For curated themes
+ `surfaceContainerLow`/`surfaceContainer` are the desktop floating surface (canvas in light;
+ in dark the code band lifted a third of the way to the user bubble, `darkFloatingFill`, about
+ `#222222` in `BrandPalette`) and `surfaceTint` is transparent, so Material sheets, menus and
+ tooltips are flat. `OpenCodeColors.signal` (the link blue; desktop `--v2-background-bg-accent`)
+ colours unread and new-item marks, since the brand `accent` is neutral; `OpenCodeColors.danger`
+ (`diffRemovedText`, desktop `--v2-state-fg-danger`) colours failure text and glyphs, while
+ `destructive` stays systemRed for destructive actions and fills. `OpenCodeColors.strongBorders`: hairlines use `borderStrong` under
+ Increase Contrast or Android's High contrast text (`rememberHighContrastText`).
+- Shapes: `OpenCodeRadius` xs 4, sm 6, fill/control 8, card/tile 10, panel 12, sheet 16;
+ Material `Shapes` extraSmall 6, small 6, medium 8, large 10, extraLarge 16;
+ `OpenCodeShape.control` (8) for buttons, pills and fields; capsule/circle only for true
+ capsules (grabbers, dots, avatars).
+- Surfaces (`ui/OpenCodeSurfaces.kt`): floating fill + 1 dp hairline (`openCodeHairline`)
+ + small shadow; `OpenCodeAlertDialog` (desktop dialog over Material's `AlertDialog`).
+- Controls: buttons 48 dp, 8 dp corners; `OpenCodeSecondaryButton` is the neutral hairline
+ button; `OpenCodeIconButton(style = Circle)` is a 10 dp rounded square with a hairline.
+ `OpenCodeSwitch` (`ui/OpenCodeFormControls.kt`) is the desktop switch (`forms/switch`): a
+ 40 × 24 dp track and an 18 dp thumb with concentric corners (7 / 4 dp, 3 dp inset), no
+ checkmark, 150 ms slides, half opacity disabled, press widens the thumb (desktop hover).
+ Off is light like the desktop (quiet `surfaceContainerHighest` track, light thumb with a
+ faint edge); its outline (row colour 85 % of the way to `tertiaryText`, full under high
+ contrast) carries the 3:1 contrast. On is `primary` / `onPrimary`; System uses Material You.
+ `OpenCodeSheetHandle` is every bottom sheet's drag handle: the desktop resize handle's
+ 40 × 4 dp pill in `tertiaryText` over Material's `DragHandle` (its band and TalkBack
+ actions stay); custom grabbers use `OpenCodeSheetHandleDefaults`. Sheets take
+ `OpenCodeSheetDefaults.shape` (16 dp top corners, `OpenCodeRadius.sheet`).
+ `OpenCodeTextField` / `OpenCodeSearchField` (`ui/OpenCodeTextField.kt`) are the desktop text
+ input (`forms/text-input`) over `BasicTextField`: the label sits above the field (no floating
+ label), placeholder shown while empty, 48 dp minimum height, 8 dp corners, 12 dp padding,
+ callout text. Fill is white in light (with a 1 dp shadow, desktop `elevation-input`) and a
+ step above the sheet in dark; a 1 dp `outline` border (`tertiaryText` under high contrast).
+ Focus is a 1.5 dp `primary` ring, error a `error` ring plus a footnote note under the field
+ (TalkBack reads it via `error()`), disabled half opacity. Custom bare fields inside their own
+ containers (composer, drawer search, browser bar, share dock) keep their containers; the
+ model picker's search rows use `Modifier.openCodeFieldContainer`.
+- Call orb (`feature/voice` `LivingOrbView`, `WispOrbShaders`): unchanged from iOS (the
+ desktop has no orb), so it keeps iOS's blue-black glass, dots, glow and shadow on the call card.
+- Call card (`feature/voice` `FloatingCall`, `VoiceCallSurfaceDefaults`): one step off the
+ page (`card`: 5% toward the text colour in light, 6% in dark) with a hairline and a soft
+ 20 dp shadow, so it separates from the canvas in both themes; the controls are 12 dp rounded
+ squares (`controlFill` + hairline, ink when on, theme red for End) instead of tonal circles.
+- Title bars (`ui/OpenCodeTopBar.kt`, Android-only): the desktop's settings/session header
+ instead of Material's `TopAppBar`s: flat canvas, 52 dp row, headline title (start or
+ centred), bare back arrow (`OpenCodeTopBarBackButton`), 1 dp bottom hairline that fades in
+ once content scrolls under it (always shown without a scroll behaviour). `OpenCodeLargeTopBar`
+ is the large-title variant (title1 under the row; Material's `exitUntilCollapsed` behaviour
+ scrolls it away and fades the small title in), used by Settings pages.
+- Camera screens (pairing scanner, composer camera) are always dark and keep the phone-camera
+ conventions where the desktop's shapes look worse over a live photo: round translucent
+ controls with a faint white hairline, and four bold round-capped viewfinder corners (5 dp,
+ 44 dp arms, following the 16 dp window radius just outside the window, scene dimmed outside it). Their bars, panels and hint text use the desktop tokens.
+- Welcome illustration: the phone mock depicts the restyled Android app (flat header, desktop
+ greys, hairline composer) rather than the iOS app's glass chrome.
Paths below are relative to `core/src/main/kotlin/ai/opencode/core/`.
## Files
| iOS file | Lines | Kotlin file(s) | Status | Notes |
| --- | ---: | --- | --- | --- |
-| `OpenCode/Core/Theme/Theme.swift` | 792 | `ui/AppTheme.kt`, `ui/OpenCodeColors.kt`, `ui/OpenCodeTheme.kt`, `ui/ThemeSharedKeys.kt` | done | `AppTheme` (iOS raw values, `@Serializable`), `AppearanceColorScheme`, `ThemeRGBA` (WCAG, OKLab/OKLCH, gamut mapping, `highContrastForeground`), `ThemeVariant`/`ThemeDefinition`, `ThemePalette.system` + `definition()`. Every dynamic provider (`canvas`, `groupedCanvas`, `groupedCard`, `codeBand`, `userBubble`, `inlineCodeFill`, text tiers, `bodyText(tone:)`, `border`, `accent`, Send button, `link`, syntax, diff) → `OpenCodeColors.resolve` with the same Increase Contrast and System-theme branches (System uses the UIKit values: `label` alpha code band, `tertiarySystemFill`, label/background Send button, systemGreen/Red diff fills). Material `onPrimary`/`onTertiary`/`onError` are white for the System theme (UIKit labels tint-filled and destructive controls white) and `highContrastForeground` for theme palettes; destructive primary buttons use white. Increase Contrast = system contrast ≥ medium (`UiModeManager.getContrast`). Keys `appearance-theme` / `appearance-color-scheme` with `.system` defaults. `applyAppAppearance()` → `OpenCodeAppTheme {}`; its window `overrideUserInterfaceStyle` (which restyles the status bar) → `OpenCodeAppTheme` sets the activity window's light/dark status and navigation bar content from the effective appearance, not the system night mode. `SettingsThemeSurface` → `OpenCodeColors.resolve(theme, isDark, highContrast)` (same values). Android divergence: the System theme follows the wallpaper (Material You dynamic colour, `ui/DynamicSystemTheme.kt`): the `ColorScheme` is the dynamic one and the iOS tokens are mapped from its roles (syntax and diff colours keep the System values); the Appearance swatches and previews read it through `rememberThemeDefinition`. The curated themes keep their fixed palettes. Not ported: UIKit trait plumbing (`AppThemeTrait`, `applyToWindows`; Compose recomposes), DEBUG `-lab-theme`/`-lab-appearance` overrides, legacy key clean-up (key never existed on Android), the 0.22 s window cross-fade on theme change (constant kept as `ThemePalette.THEME_CHANGE_CROSSFADE_SECONDS`) |
+| `OpenCode/Core/Theme/Theme.swift` | 792 | `ui/AppTheme.kt`, `ui/OpenCodeColors.kt`, `ui/OpenCodeTheme.kt`, `ui/ThemeSharedKeys.kt` | done | `AppTheme` (iOS raw values, `@Serializable`), `AppearanceColorScheme`, `ThemeRGBA` (WCAG, OKLab/OKLCH, gamut mapping, `highContrastForeground`), `ThemeVariant`/`ThemeDefinition`, `ThemePalette.system` + `definition()`. Every dynamic provider (`canvas`, `groupedCanvas`, `groupedCard`, `codeBand`, `userBubble`, `inlineCodeFill`, text tiers, `bodyText(tone:)`, `border`, `accent`, Send button, `link`, syntax, diff) → `OpenCodeColors.resolve` with the same Increase Contrast and System-theme branches (System uses the UIKit values: `label` alpha code band, `tertiarySystemFill`, label/background Send button, systemGreen/Red diff fills). Material `onPrimary`/`onTertiary`/`onError` are white for the System theme (UIKit labels tint-filled and destructive controls white) and `highContrastForeground` for theme palettes; destructive primary buttons use white. Increase Contrast = system contrast ≥ medium (`UiModeManager.getContrast`). Keys `appearance-theme` / `appearance-color-scheme`; Android divergence: `appearance-theme` defaults to `oc-2` (the desktop palette, `BrandPalette`) instead of `.system`. `applyAppAppearance()` → `OpenCodeAppTheme {}`; its window `overrideUserInterfaceStyle` (which restyles the status bar) → `OpenCodeAppTheme` sets the activity window's light/dark status and navigation bar content from the effective appearance, not the system night mode. `SettingsThemeSurface` → `OpenCodeColors.resolve(theme, isDark, highContrast)` (same values). Android divergence: the System theme follows the wallpaper (Material You dynamic colour, `ui/DynamicSystemTheme.kt`): the `ColorScheme` is the dynamic one and the iOS tokens are mapped from its roles (syntax and diff colours keep the System values); the Appearance swatches and previews read it through `rememberThemeDefinition`. The curated themes keep their fixed palettes. Not ported: UIKit trait plumbing (`AppThemeTrait`, `applyToWindows`; Compose recomposes), DEBUG `-lab-theme`/`-lab-appearance` overrides, legacy key clean-up (key never existed on Android), the 0.22 s window cross-fade on theme change (constant kept as `ThemePalette.THEME_CHANGE_CROSSFADE_SECONDS`) |
| `OpenCode/Core/Theme/ThemePalette+Generated.swift` | 397 | `ui/ThemePaletteGenerated.kt` (generated by `scripts/generate-themes-android.py`) | done | Every value copied from the generated Swift (6 themes × light/dark × 28 tokens); rerun the script when iOS regenerates |
| `OpenCode/Core/Motion/MotionConstants.swift` | 130 | `motion/MotionConstants.kt`, `motion/OpenCodeMotionScheme.kt` | done | All 9 springs (`MotionSpring(duration, bounce)` → exact `spring(ζ, ω²)`), fades, delays, stagger, handover ratio, blur radii, rises; `animation(reduceMotion:delay:)`, `easeOut`/`easeInOut` with SwiftUI's curves; Reduce Motion → 0.2 s ease-in-out (`rememberReduceMotion()` = Remove animations). Android divergence: the M3 `MotionScheme` (`OpenCodeMotionScheme`) is Material 3 Expressive's own (`MotionScheme.expressive()`), so Material components move like the rest of Android; Reduce Motion still turns every spec into the 0.2 s fade. Android divergence: transition blurs (SwiftUI `.blur(radius:)` in a transition, `MotionBlurReveal`, `MorphReveal`, the text focus sweep, caption words) are off through `motion/TransitionBlur.kt` (`transitionBlur`, `transitionBlurEffect`, `TransitionBlur.enabled`); the blur maths and their ported tests stay. Backdrop blurs are unchanged. Android-only `motion/PageTransitions.kt`: Material shared axis X (forward, backward, predictive back) and fade through, for page changes (Settings). Every value is a live `Tunable` (`MotionTunables`, iOS keys/labels/defaults/ranges, `core/.../tuning/`), read through `Motion.*` getters; springs and tweens follow Developer Mode slow motion (`AnimationTimeScale`: ω × s, durations ÷ s); `MotionTunables.register()` = iOS `Motion.register(in:)` |
| `OpenCode/Core/Motion/SpringSolver.swift` | 222 | `motion/SpringSolver.kt` | done | Same closed-form critically/under/over-damped solutions, epsilons, `retarget`, `step`, `parameters`; `(duration, bounce)` init is `SpringSolver.of(...)` or `SpringSolver(MotionSpring)` (JVM overload clash) |
@@ -20,18 +84,20 @@ Paths below are relative to `core/src/main/kotlin/ai/opencode/core/`.
| `OpenCode/Core/Motion/MotionDisplayLink.swift` | 90 | `motion/MotionFrameLoop.kt` | done | `motionFrameLoop {}` on Compose's frame clock (`withFrameNanos`, display rate up to 120 Hz), `dt = min(delta, maxFrames × frame) × scale`, first frame one frame long, `Continue`/`Stop`; `rememberFrameDurationSeconds()`. No explicit 80–120 Hz range request (Android picks the rate per window; Compose drives at the display rate). the scale is read every frame from `AnimationTimeScale.shared.scale` unless `timeScale` pins it (Developer Mode slow motion, `core/.../tuning/AnimationTimeScale.kt`) Android perf: `rememberReduceMotion()` reads one app-wide observer of the animator scale instead of registering one per caller (rows paid a settings-service round trip each as they scrolled in). |
| `OpenCode/Core/RollingNumber/RollingNumber.swift` | 928 | `ui/RollingNumberModel.kt`, `ui/RollingNumber.kt` | done | Model ported line for line (keys, parse with locale separators over Swift `Character`s = grapheme clusters, unwrap and settle with Swift's half-away-from-zero rounding, stagger, 240 Hz semi-implicit springs stepped on `AnimationTimeScale`, hold/rise/blur envelopes, alignment, settle). Rendering: Compose `Canvas` + `TextMeasurer`, tabular digits, edge fade mask, clipped to its line like iOS's Canvas (callers don't clip), baseline alignment, plain-text cross-fade fallback (Reduce Motion, RTL, not resumed, too narrow, unrollable; one line, wrapping only at accessibility font scales as iOS's `fixedSize`). Smear drawn from a 0.45 band radius (shader's cut-off) and arrival/exit blur above 0.3, as iOS. Presets `Native/Snappy/Gentle/Lively`; `RollingNumberTunables` (`ui/RollingNumberTunables.kt`: `numbers.*` keys, `numbers.presets` feels, `register`, `style()`) is the default `motion`. Arrival/exit blur drawn as the same vertical smear (iOS: isotropic per-glyph blur). `isRollingNumberSizingOnly` environment not needed (Compose measures without drawing) Android perf: glyph metrics are shared per style (`SharedRollingMetrics`, the 8 most recent styles, colour not in the key), so a row scrolling in doesn't measure its digits again. Formats and parses in `appFormattingLocale()` (`ui/AppFormattingLocale.kt`: English in the configuration's region, iOS `Locale.current` in an English-only bundle) |
| `OpenCode/Core/RollingNumber/RollingNumberShaders.metal` | 33 | `ui/RollingNumber.kt` (`drawRollingFrame`) | done | Same intent without a shader: per-band vertical Gaussian (`exp(-2.5t²)`, radius from reel speed) as a 9-tap additive offscreen composite (`BlendMode.Plus`) |
-| `OpenCode/Core/Glass.swift` | 30 | `ui/OpenCodeButtons.kt`, `ui/OpenCodeShapes.kt` | done | `openCodePrimaryButton()` → `OpenCodePrimaryButton` (M3 filled, accent; red only for `Destructive`); `openCodeSecondaryButton()` → `OpenCodeSecondaryButton` (M3 tonal, neutral `secondaryContainer`); shared 52 dp height for peers. `GlassGeometry.radius` → `OpenCodeShapeGeometry.radius` (iOS removed the unused `GlassShape.clamped` wrapper in 18771799; `OpenCodeShapeGeometry.clamped` went with it). `openCodeGlass(in:interactive:tint:)`: n/a, Liquid Glass maps to Material tonal surfaces (`Surface(color = surfaceContainer*)`), never blur; iOS 27 availability gates: n/a |
-| `OpenCode/Core/TapTarget.swift` | 53 | `ui/TapTarget.kt` | done | `Modifier.openCodeTapTarget(minSize = 48.dp, accessibility = true)`: centred ≥48 dp rectangle, one merged TalkBack node (Android's 48 dp ≙ iOS 44 pt). `openCodeGlassCircle(_:tint:)` → `OpenCodeIconButton(style = Circle, size, tint)` (M3 filled tonal icon button, circle); `Standard` style for bare toolbar glyphs Sync ae029f85 (86ca6803, 6a173ff1): `openCodeTapTarget(lowered:)` and `openCodeAccessibilityTarget(lowered:)` aren't added: their only callers are the composer's pickers, which lower themselves with an offset pair (`targetDrop`, see composer.md) since Compose moves touch and semantics bounds together. |
+| `OpenCode/Core/Glass.swift` | 30 | `ui/OpenCodeButtons.kt`, `ui/OpenCodeShapes.kt` | done | `openCodePrimaryButton()` → `OpenCodePrimaryButton` (M3 filled, accent; red only for `Destructive`); `openCodeSecondaryButton()` → `OpenCodeSecondaryButton` (base surface with a hairline: the desktop's neutral button); shared 48 dp height for peers, 8 dp corners. `GlassGeometry.radius` → `OpenCodeShapeGeometry.radius` (iOS removed the unused `GlassShape.clamped` wrapper in 18771799; `OpenCodeShapeGeometry.clamped` went with it). `openCodeGlass(in:interactive:tint:)`: n/a, Liquid Glass maps to the desktop's flat floating surfaces (`OpenCodeSurfaces`: fill + hairline + small shadow), never blur; iOS 27 availability gates: n/a |
+| `OpenCode/Core/TapTarget.swift` | 53 | `ui/TapTarget.kt` | done | `Modifier.openCodeTapTarget(minSize = 48.dp, accessibility = true)`: centred ≥48 dp rectangle, one merged TalkBack node (Android's 48 dp ≙ iOS 44 pt). `openCodeGlassCircle(_:tint:)` → `OpenCodeIconButton(style = Circle, size, tint)` (desktop neutral icon button: 10 dp rounded square, hairline; filled when tinted); `Standard` style for bare toolbar glyphs Sync ae029f85 (86ca6803, 6a173ff1): `openCodeTapTarget(lowered:)` and `openCodeAccessibilityTarget(lowered:)` aren't added: their only callers are the composer's pickers, which lower themselves with an offset pair (`targetDrop`, see composer.md) since Compose moves touch and semantics bounds together. |
| `OpenCode/Core/BackSwipe.swift` | 390 | `ui/BackSwipeRules.kt` | done | `edgeWidth` 28, hold 0.45 s, decision distance 8, handle reach 24, `decision(...)`, `yieldsToHold`, release rule `goesBack` (250/s flick, else halfway) for the in-app drawer pan. n/a: `BackPanGestureRecognizer`, `SystemBackSwipeGate`, scroller/control/selection hit tests (system back and predictive back are Android's; nested scrolling and text selection already arbitrate). `BackSwipeSpring` → `SpringSolver(Motion.drawerSlide)` + `motionFrameLoop` in the drawer feature Sync ae029f85 (665f985d): comment-only (`selectionHandleReach` now also names the reply selection's handles; Android `TranscriptReplySelection.HANDLE_REACH` is 24 dp). |
| `OpenCode/Core/Motion/RenderServerLoop.swift` | 80 | — | n/a: a Core Animation loop re-added after suspension or cell reuse; Compose's infinite transitions run on the frame clock and restart with a reused composition, so the drawer ring and Server Flow sweep can't be dropped | Sync ae029f85 (a599a6a4, 76dd31fd). |
## Design-system API (for area agents)
- Theme: wrap each window's root in `OpenCodeAppTheme { }` (reads the persisted choice); previews use `OpenCodeTheme(theme, appearance) { }`. Colours: `OpenCodeTheme.colors.` (e.g. `groupedCard`, `secondaryText`, `bodyText(0.92)`, `syntaxKeyword`); Material roles: `MaterialTheme.colorScheme` (mapping table in `OpenCodeColors.kt`).
-- Type: `MaterialTheme.typography.*` (role mapping in `OpenCodeTypography.kt`) or the iOS names in `OpenCodeTextStyles` (`footnote`, `subheadline`, …). `OpenCodeFonts.berkeleyMono` only for onboarding brand marks.
-- Shapes and spacing: `OpenCodeShape.capsule/circle/card/panel/sheet`, `OpenCodeRadius.*`, `OpenCodeSpacing.*`.
+- Type: `MaterialTheme.typography.*` (role mapping in `OpenCodeTypography.kt`) or the iOS names in `OpenCodeTextStyles` (`footnote`, `subheadline`, …), Inter at desktop sizes; code in `OpenCodeFonts.monospace` (IBM Plex Mono). `OpenCodeFonts.berkeleyMono` only for the wordmark.
+- Shapes and spacing: `OpenCodeShape.control` for controls, `capsule/circle` for true capsules, `card/panel/sheet`, `OpenCodeRadius.*`, `OpenCodeSpacing.*`.
+- Surfaces: `OpenCodeSurfaces.color/border/dialogShape/popoverShape/raisedShadow/popoverShadow`, `Modifier.openCodeHairline(shape)`, `OpenCodeAlertDialog` instead of `AlertDialog`; Material `Button`s take `shape = OpenCodeShape.control`.
- Motion: `Motion..spec()` / `.animation(reduceMotion)`, `Motion.easeOut(Motion.fadeStandard, …)`, `rememberReduceMotion()`, `SpringSolver` + `motionFrameLoop {}` for custom drivers, `PresenceGate`, `Modifier.motionBlurReveal`.
-- Controls: `OpenCodePrimaryButton` / `OpenCodeSecondaryButton` (`role = Destructive` for red), `OpenCodeIconButton(SFSymbol.X, "Label", onClick)`, `Modifier.openCodeTapTarget()` after `clickable`.
+- Title bars: `OpenCodeTopBar(title = { Text(...) }, navigation = { OpenCodeTopBarBackButton(onBack) }, actions = { ... }, centerTitle, scrollBehavior)` or `OpenCodeLargeTopBar("Title", TopAppBarDefaults.exitUntilCollapsedScrollBehavior())` instead of Material `TopAppBar`s; put the behaviour's `nestedScrollConnection` on the `Scaffold`.
+- Controls: `OpenCodePrimaryButton` / `OpenCodeSecondaryButton` (`role = Destructive` for red), `OpenCodeIconButton(SFSymbol.X, "Label", onClick)`, `Modifier.openCodeTapTarget()` after `clickable`; `OpenCodeSwitch(checked, onCheckedChange)` instead of Material's `Switch` (pass `null` when the row is the toggleable); sheets take `dragHandle = { OpenCodeSheetHandle() }` and `shape = OpenCodeSheetDefaults.shape` (both the default in `OpenCodeBottomSheet`); `OpenCodeTextField(value, onValueChange, label = "…", placeholder = "…")` and `OpenCodeSearchField` instead of Material's `OutlinedTextField` / `TextField`.
- Icons: `OpenCodeIcon(SFSymbol.ArrowUpCircleFill, contentDescription)` or `OpenCodeIcon("arrow.up", …)` / `sfSymbol(name)` for names held as strings. New icon: add a line to `scripts/material-symbols.txt`, run `python3 scripts/fetch-material-symbols.py`, add the `SFSymbol` entry and a row below.
- TalkBack focus (`ui/AccessibilityFocus.kt`, moved down from `:feature:composer`'s `AttachmentMenu.kt`; one helper where VoiceOver moves by itself): `Modifier.accessibilityFocusRequest(request)` moves TalkBack's focus onto the element once per `AccessibilityFocusRequest` (after a window on top hands focus back); a request is spent by its move, so a recomposition, a remount or a session moved into Catch Up's stack never replays it (QA W-05); `rememberAccessibilityFocusRequest(event)` makes a new one for each new non-null `event`; `LocalAccessibilityFocusMoves` false (Catch Up's inert preview card) turns every move off; a move refused because the element isn't in the accessibility tree yet (fading in) tries again each frame for up to 1 s (QA AF-02: Catch Up's Leave was always refused and only TalkBack's own pick landed there); `Modifier.accessibilityFocusTarget(target)` + `AccessibilityFocusTarget.focus()` move it when the caller decides. Both mark their semantics node (ahead of any `clearAndSetSemantics`), find it in the view's tree and perform `ACTION_ACCESSIBILITY_FOCUS` through the view's accessibility node provider. Compose has no public accessibility-focus API and no public node → id mapping (`requireSemanticsInfo` is internal), so the tree comes from `RootForTest` in this one file.
- Gallery: `DesignSystemGallery()` (`ui/DesignSystemGallery.kt`).
diff --git a/docs/parity/session.md b/docs/parity/session.md
index 1562ad0e9..4d98af952 100644
--- a/docs/parity/session.md
+++ b/docs/parity/session.md
@@ -15,7 +15,7 @@ Status values: `todo`, `partial: `, `done`, `n/a: `, `done`, `n/a: `, monogram tile only when the mark isn't bundled), monogram hash and status ring ported; marks are `:core`'s bundled SVGs (`BrandAssets`, `TemplateAssetImage`) tinted with the glyph colour; `muted` desaturates the whole tile (fill, glyph) like `.saturation(0)`; the status ring's turn (82b1ede8: paused off-screen, slow-motion scaled) is a `rememberInfiniteTransition`, which already stops when the window isn't drawn and follows the system animator scale |
diff --git a/docs/parity/voice.md b/docs/parity/voice.md
index f4d45594a..c595dd55e 100644
--- a/docs/parity/voice.md
+++ b/docs/parity/voice.md
@@ -13,7 +13,7 @@ Status values: `todo`, `partial: `, `done`, `n/a: `, `done`, `n/a: ` for the float4 groups. Sync b1c67259 (f09da653): the preview hooks `setQuietSecsForPreview`/`setElapsedForPreview` removed. |
| `OpenCode/Voice/WispOrbSim.swift` | 476 | `WispOrbSim.kt` | done | `WispOrbSim` (240 Hz fixed step, `stepStill` under reduce motion, `frame` → uniforms, FNV-1a tool hash), `WispOrbPlacement`, `WispOrbUniforms` (one flat `FloatArray` of 66 float4 slots, named slot constants in the shader’s order). Sync b1c67259 (f09da653): `pushPulse` removed (no callers). |
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AttachmentCameraView.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AttachmentCameraView.kt
index d5e413ae2..77c19af49 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AttachmentCameraView.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AttachmentCameraView.kt
@@ -7,7 +7,9 @@ import ai.opencode.core.motion.Motion
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.ui.OpenCodeIcon
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.ui.OpenCodeShape
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.SFSymbol
import ai.opencode.core.ui.openCodeTapTarget
@@ -64,6 +66,8 @@ import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@@ -81,6 +85,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
+import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
@@ -114,10 +119,6 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.currentStateAsState
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.launch
import java.io.ByteArrayOutputStream
import java.util.UUID
import kotlin.math.abs
@@ -127,6 +128,10 @@ import kotlin.math.max
import kotlin.math.min
import kotlin.math.pow
import kotlin.math.roundToInt
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
/**
* A still camera presented full screen; the preview fills the display while the controls
@@ -198,16 +203,17 @@ fun AttachmentCameraView(
Modifier
.align(Alignment.Center)
.padding(start = 16.dp, end = 16.dp, bottom = 72.dp)
- .background(Color.Black.copy(alpha = 0.7f))
- .padding(12.dp),
+ .background(Color.Black.copy(alpha = 0.65f), OpenCodeShape.panel)
+ .border(OpenCodeSurfaces.hairline, CameraChromeHairline, OpenCodeShape.panel)
+ .padding(horizontal = 16.dp, vertical = 12.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Text(message, style = OpenCodeTextStyles.subheadline, textAlign = TextAlign.Center, color = Color.White)
if (camera.needsSettings) {
- TextButton(onClick = camera::openSettings) { Text("Open Settings") }
+ CameraMessageButton("Open Settings", onClick = camera::openSettings)
} else if (camera.canRetry) {
- TextButton(onClick = camera::activate) { Text("Try Again") }
+ CameraMessageButton("Try Again", onClick = camera::activate)
}
}
}
@@ -409,8 +415,8 @@ fun AttachmentCameraControls(
color = Color.Black,
style = OpenCodeTextStyles.caption1.copy(fontWeight = FontWeight.SemiBold),
modifier = Modifier
- .background(CameraYellow, OpenCodeShape.capsule)
- .padding(horizontal = 8.dp, vertical = 4.dp),
+ .background(CameraYellow, RoundedCornerShape(OpenCodeRadius.xs))
+ .padding(horizontal = 6.dp, vertical = 3.dp),
)
}
Spacer(Modifier.weight(1f))
@@ -470,7 +476,28 @@ fun AttachmentCameraControls(
private val CameraYellow = Color(0xFFFFD60A)
-/** iOS `openCodeGlassCircle(tint: .black.opacity(0.3))` over the preview. */
+/** The controls' translucent dark fill over the preview: light enough to let the photo through. */
+private val CameraChromeFill = Color.Black.copy(alpha = 0.3f)
+
+/** The controls' hairline over the preview, which keeps them visible over bright scenes. */
+private val CameraChromeHairline = Color.White.copy(alpha = 0.22f)
+
+/** The camera message's action: a plain white label with the desktop's control corners. */
+@Composable
+private fun CameraMessageButton(label: String, onClick: () -> Unit) {
+ TextButton(
+ onClick = onClick,
+ shape = OpenCodeShape.control,
+ colors = ButtonDefaults.textButtonColors(contentColor = Color.White),
+ ) {
+ Text(label, style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.Medium))
+ }
+}
+
+/**
+ * iOS `openCodeGlassCircle(tint: .black.opacity(0.3))` over the preview: a translucent circle with a
+ * hairline. Camera controls stay round, as on every phone camera, rather than the desktop's squares.
+ */
@Composable
private fun CameraCircleButton(
symbol: SFSymbol,
@@ -484,7 +511,9 @@ private fun CameraCircleButton(
Box(
modifier
.size(48.dp)
- .background(Color.Black.copy(alpha = 0.3f), CircleShape)
+ .clip(CircleShape)
+ .background(CameraChromeFill)
+ .border(OpenCodeSurfaces.hairline, CameraChromeHairline, CircleShape)
.clickable(enabled = enabled, role = Role.Button, onClick = onClick)
.openCodeTapTarget()
.clearAndSetSemantics {
@@ -517,7 +546,6 @@ private fun AttachmentLensPicker(
HapticEffect(Haptic.selection, trigger = active?.id) { _, _ -> isPinching }
Row(
modifier
- .background(Color.Black.copy(alpha = 0.25f), OpenCodeShape.capsule)
.padding(2.dp),
verticalAlignment = Alignment.CenterVertically,
) {
@@ -546,7 +574,8 @@ private fun AttachmentLensPicker(
Box(
Modifier
.size(side.dp)
- .background(Color.Black.copy(alpha = 0.45f), CircleShape),
+ .background(CameraChromeFill, CircleShape)
+ .border(OpenCodeSurfaces.hairline, CameraChromeHairline, CircleShape),
contentAlignment = Alignment.Center,
) {
Text(
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AttachmentMenu.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AttachmentMenu.kt
index f3509d629..7f0129290 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AttachmentMenu.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AttachmentMenu.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.composer
+import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.motion.Motion
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.motion.rememberReduceMotion
@@ -20,6 +21,7 @@ import androidx.compose.animation.core.FiniteAnimationSpec
import androidx.compose.animation.core.TwoWayConverter
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.snap
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
@@ -176,10 +178,10 @@ object AttachmentMenuMotion {
/** iOS `AttachmentMenuMetrics` (points → dp). */
object AttachmentMenuMetrics {
- /** The composer's, so the menu and the card read as the same surface. */
- val cornerRadius: Dp = 28.dp
- /** Between the panel's edge and its rows; the highlight is concentric. */
- val padding: Dp = 6.dp
+ /** The composer's, so the menu and the card read as the same surface (the desktop dock's 12). */
+ val cornerRadius: Dp = 12.dp
+ /** Between the panel's edge and its rows; the highlight is concentric (desktop context menu: 4). */
+ val padding: Dp = 4.dp
/** Between the composer's top edge and the menu's or card's bottom edge. */
val composerGap: Dp = 10.dp
val minimumWidth: Dp = 210.dp
@@ -231,7 +233,8 @@ object PlusMenuTunables {
const val MENU_DROP = 80f
/** The menu's width, × the screen's. */
const val MENU_WIDTH = 0.63f
- const val MENU_RADIUS = 28f
+ /** The open menu's corners: the desktop popover radius (`OpenCodeRadius.card`), as on the session’s ⋮ menu. */
+ const val MENU_RADIUS = 10f
const val MENU_ROW_HEIGHT = 56f
/** The menu's leading edge in from the composer's. */
const val MENU_INSET = 0f
@@ -369,14 +372,15 @@ private fun AttachmentMenuRowLabel(item: AttachmentMenuItem, iconWidth: Dp, inse
.width(iconWidth)
.then(
if (circularIcon) {
- Modifier.height(iconWidth).background(MaterialTheme.colorScheme.surfaceContainerHighest, androidx.compose.foundation.shape.CircleShape)
+ // Desktop context menus draw bare glyphs, no discs.
+ Modifier.height(iconWidth)
} else Modifier,
),
contentAlignment = Alignment.Center,
) {
- OpenCodeIcon(item.systemImage, contentDescription = null, tint = OpenCodeTheme.colors.text)
+ OpenCodeIcon(item.systemImage, contentDescription = null, size = 20.dp, tint = OpenCodeTheme.colors.secondaryText)
}
- Text(item.title, style = OpenCodeTextStyles.body, color = OpenCodeTheme.colors.text, maxLines = 1)
+ Text(item.title, style = OpenCodeTextStyles.callout.copy(fontWeight = FontWeight.Medium), color = OpenCodeTheme.colors.text, maxLines = 1)
Spacer(Modifier.width(24.dp))
}
}
@@ -853,7 +857,7 @@ internal fun attachmentMenuFrames(
/** The card's colour: what the cover fades in and out as (iOS `SystemPasteControl.glass`, the panel's opaque colour). */
@Composable
-private fun panelColor(): androidx.compose.ui.graphics.Color = MaterialTheme.colorScheme.surfaceContainer
+private fun panelColor(): androidx.compose.ui.graphics.Color = OpenCodeTheme.colors.let { if (it.isDark) it.codeBand else it.canvas }
@Composable
private fun AttachmentMenuPanel(
@@ -883,8 +887,9 @@ private fun AttachmentMenuPanel(
),
shape = shape,
color = panelColor(),
- tonalElevation = 3.dp,
- shadowElevation = 6.dp,
+ // The desktop popover: flat fill, hairline ring, soft shadow (`--shadow-md`).
+ border = BorderStroke(1.dp, OpenCodeTheme.colors.border),
+ shadowElevation = 4.dp,
) {
Box(Modifier.fillMaxSize().clip(shape)) { content() }
}
@@ -1074,7 +1079,7 @@ private fun CardControls(
Row(
Modifier
.heightIn(min = header)
- .clip(RoundedCornerShape(percent = 50))
+ .clip(OpenCodeShape.control)
.background(MaterialTheme.colorScheme.surfaceContainerHighest)
.then(
if (interactive) {
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AutocompleteTunables.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AutocompleteTunables.kt
index 88b709ca5..099552662 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AutocompleteTunables.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/AutocompleteTunables.kt
@@ -86,8 +86,8 @@ object ComposerAutocompleteTunables {
/** `composer.autocomplete.reduceFade` "Reduce Motion fade (s)" (0.1…0.4). */
const val reduceFade = 0.18
- /** iOS `ComposerTunables.cornerRadius` (`composer.size.cornerRadius`), the glass the highlight sits concentric in. */
- const val composerCornerRadius = 28.0
+ /** `ComposerTunables.cornerRadius` (the desktop dock's 12; iOS 28), the surface the highlight sits concentric in. */
+ const val composerCornerRadius = 12.0
/** An iOS `TuningPreset`: a name and the parameters it sets (everything else resets to default). */
data class Preset(val name: String, val apply: (AutocompleteParameters) -> AutocompleteParameters)
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/OpenCodeBottomSheet.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/OpenCodeBottomSheet.kt
index 04a87e741..e97262c03 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/OpenCodeBottomSheet.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/OpenCodeBottomSheet.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.composer
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
import android.view.KeyEvent
import android.view.Window
import androidx.activity.compose.BackHandler
@@ -111,12 +113,19 @@ fun OpenCodeBottomSheet(
onDismissRequest: () -> Unit,
sheetState: SheetState,
modifier: Modifier = Modifier,
- dragHandle: @Composable () -> Unit = { BottomSheetDefaults.DragHandle() },
+ dragHandle: @Composable () -> Unit = { OpenCodeSheetHandle() },
content: @Composable ColumnScope.() -> Unit,
) {
val presentations = LocalSheetPresentations.current
if (presentations == null) {
- ModalBottomSheet(onDismissRequest, modifier, sheetState, dragHandle = dragHandle, content = content)
+ ModalBottomSheet(
+ onDismissRequest,
+ modifier,
+ sheetState,
+ shape = OpenCodeSheetDefaults.shape,
+ dragHandle = dragHandle,
+ content = content,
+ )
return
}
// Preserve the presenting session's dependencies, lifecycle and typography at the host.
@@ -174,6 +183,7 @@ private fun InWindowSheet(
modifier = modifier.align(Alignment.TopCenter).consumeWindowInsets(offsetInsets),
state = sheetState,
onDismissRequest = onDismissRequest,
+ shape = OpenCodeSheetDefaults.shape,
dragHandle = dragHandle,
contentWindowInsets = { BottomSheetDefaults.modalWindowInsets },
tonalElevation = 0.dp,
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/PastedTextViews.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/PastedTextViews.kt
index 017ea42be..e9fa79b5b 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/PastedTextViews.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/PastedTextViews.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.composer
+import ai.opencode.core.ui.OpenCodeTopBar
import ai.opencode.core.haptics.Haptic
import ai.opencode.core.haptics.HapticEffect
import ai.opencode.core.ui.OpenCodeFonts
@@ -30,7 +31,6 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.selection.SelectionContainer
-import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.IconButton
@@ -38,7 +38,6 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
-import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -194,8 +193,8 @@ fun PastedTextViewer(
modifier = modifier.semantics { testTag = "pasted-text-viewer" },
containerColor = OpenCodeTheme.colors.canvas,
topBar = {
- CenterAlignedTopAppBar(
- colors = TopAppBarDefaults.centerAlignedTopAppBarColors(containerColor = OpenCodeTheme.colors.canvas),
+ OpenCodeTopBar(
+ centerTitle = true,
title = {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
@@ -205,7 +204,7 @@ fun PastedTextViewer(
Text(summary.summary, style = OpenCodeTextStyles.caption1, color = OpenCodeTheme.colors.secondaryText)
}
},
- navigationIcon = {
+ navigation = {
TextButton(onClick = onDone, modifier = Modifier.semantics { testTag = "pasted-text-done" }) { Text("Done") }
},
actions = {
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/PermissionPanelParts.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/PermissionPanelParts.kt
index 79be260de..eb2596d0a 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/PermissionPanelParts.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/PermissionPanelParts.kt
@@ -1,5 +1,9 @@
package ai.opencode.feature.composer
+import ai.opencode.core.ui.OpenCodeSurfaces
+import ai.opencode.core.ui.openCodeHairline
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.foundation.BorderStroke
import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.server.model.OpenCodePermissionRequest
@@ -34,7 +38,7 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.withStyle
@@ -92,17 +96,17 @@ object RequestTunables {
/** `requests.permission.labelHeight`: the action label's height (20…44); with the button's padding, a 48 dp target. */
val labelHeight = 30.dp
/** `requests.permission.buttonRadius`: the actions' corner radius (6…24), the card's family rather than a capsule. */
- val buttonRadius = 14.dp
+ val buttonRadius = 8.dp
}
/** iOS `TranscriptMetrics` fonts and corner the request panel borrows (the transcript module sits beside this one). */
internal object RequestTranscriptMetrics {
/** `TranscriptMetrics.toolFont`: footnote, monospaced. */
- val toolFont: TextStyle get() = OpenCodeTextStyles.footnote.copy(fontFamily = FontFamily.Monospace)
+ val toolFont: TextStyle get() = OpenCodeTextStyles.footnote.copy(fontFamily = OpenCodeFonts.monospace)
/** `TranscriptMetrics.codeFont`: subheadline, monospaced. */
- val codeFont: TextStyle get() = OpenCodeTextStyles.subheadline.copy(fontFamily = FontFamily.Monospace)
+ val codeFont: TextStyle get() = OpenCodeTextStyles.subheadline.copy(fontFamily = OpenCodeFonts.monospace)
/** `TranscriptMetrics.controlCornerRadius`. */
- val controlCornerRadius = 10.dp
+ val controlCornerRadius = 6.dp
/** `TranscriptBandStyle.verticalPadding`: from a hairline to the content's first line box. */
val bandVerticalPadding = 12.dp
}
@@ -110,7 +114,7 @@ internal object RequestTranscriptMetrics {
/**
* A permission action (iOS `requestPermissionButtonShape()` inside the shared button
* styles): normal height, its corners [RequestTunables.buttonRadius]. Primary is the
- * accent fill (Always Allow), secondary the neutral tonal one (Allow Once).
+ * accent fill (Always Allow), secondary the desktop's neutral hairline one (Allow Once).
*/
@Composable
internal fun RequestPermissionButton(
@@ -126,7 +130,13 @@ internal fun RequestPermissionButton(
if (primary) {
Button(onClick, sized, enabled, shape = shape, colors = ButtonDefaults.buttonColors(), contentPadding = padding, content = content)
} else {
- FilledTonalButton(onClick, sized, enabled, shape = shape, colors = ButtonDefaults.filledTonalButtonColors(), contentPadding = padding, content = content)
+ // The desktop's neutral button: a light neutral fill and a hairline.
+ FilledTonalButton(
+ onClick, sized, enabled, shape = shape,
+ colors = ButtonDefaults.filledTonalButtonColors(containerColor = OpenCodeSurfaces.neutralFill, contentColor = OpenCodeTheme.colors.text),
+ border = BorderStroke(1.dp, OpenCodeTheme.colors.border),
+ contentPadding = padding, content = content,
+ )
}
}
@@ -224,7 +234,8 @@ private fun PermissionBand(text: String) {
private fun DiffPreview(patch: String, modifier: Modifier = Modifier) {
val colors = OpenCodeTheme.colors
val lines = remember(patch) { DiffPreviewLines.lines(patch) }
- Column(modifier.clip(RoundedCornerShape(RequestTranscriptMetrics.controlCornerRadius))) {
+ // The desktop diff block: a hairline ring around the lines.
+ Column(modifier.clip(RoundedCornerShape(RequestTranscriptMetrics.controlCornerRadius)).openCodeHairline(RoundedCornerShape(RequestTranscriptMetrics.controlCornerRadius))) {
for (line in lines) {
val (foreground, fill) = when (line.kind) {
DiffPreviewLines.Kind.Added -> colors.diffAddedText to colors.diffAddedFill
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/QueuedMessagesSheet.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/QueuedMessagesSheet.kt
index 05c0d87dc..99cba3a33 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/QueuedMessagesSheet.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/QueuedMessagesSheet.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.composer
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
import ai.opencode.core.files.AttachmentFileType
import ai.opencode.core.motion.Motion
import ai.opencode.core.motion.rememberReduceMotion
@@ -108,6 +110,8 @@ fun QueuedMessagesSheet(
onDismissRequest = onClose,
sheetState = sheetState,
containerColor = OpenCodeTheme.colors.groupedCanvas,
+ dragHandle = { OpenCodeSheetHandle() },
+ shape = OpenCodeSheetDefaults.shape,
) {
Column(
Modifier
@@ -407,7 +411,7 @@ private fun QueuedRowActions(onCancel: () -> Unit, onSendNow: () -> Unit, modifi
) {
Box(
contentAlignment = Alignment.Center,
- modifier = Modifier.size(30.dp).background(MaterialTheme.colorScheme.surfaceContainerHighest, CircleShape),
+ modifier = Modifier.size(30.dp).background(MaterialTheme.colorScheme.surfaceContainerHighest, RoundedCornerShape(8.dp)),
) {
OpenCodeIcon(SFSymbol.ArrowUp, contentDescription = null, size = OpenCodeIconSize.small, tint = OpenCodeTheme.colors.text)
}
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/RequestDockView.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/RequestDockView.kt
index f55305ecc..efc9fd007 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/RequestDockView.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/RequestDockView.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.composer
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.haptics.Haptic
import ai.opencode.core.haptics.HapticsClient
@@ -31,7 +32,6 @@ import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.FiniteAnimationSpec
import androidx.compose.animation.core.animateFloatAsState
-import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.Arrangement
@@ -51,7 +51,6 @@ import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.LocalContentColor
-import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -128,12 +127,12 @@ object RequestDockMetrics {
val scrollFloor: Dp = 64.dp
/** One edge for the caption, the question, the marks, and the bands. */
val edge: Dp = 20.dp
- /** The composer's glass, which the panel shares. */
- val cornerRadius: Dp = 28.dp
+ /** The composer's surface, which the panel shares (the desktop dock's 12; iOS's glass is 28). */
+ val cornerRadius: Dp = 12.dp
/** × is a circle centred on the glass's top-trailing corner arc, so its edge runs concentric with the glass's corner. */
val closeSize: Dp = 34.dp
- /** The header's row is centred on that arc too. */
- val headerTop: Dp = cornerRadius - 22.dp
+ /** The header row's inset from the top (iOS centres it on the 28 pt corner arc: 6). */
+ val headerTop: Dp = 6.dp
/** How far a request's content rises out of the bar as it arrives. */
val rise: Dp = 28.dp
/** The blur a request's content sharpens in from and blurs away to (iOS `.blur(radius: 8)`). */
@@ -537,10 +536,10 @@ private class DockScope(
fun CloseButton(busy: Boolean) {
val colors = OpenCodeTheme.colors
val idle = dock.respondingRequestIDs.isEmpty()
- // Its centre on the corner arc's: `cornerRadius` in from the edge.
+ // Where iOS centres it on the corner arc; the desktop's small corner keeps that place.
Box(
Modifier
- .outset(end = RequestDockMetrics.edge - (RequestDockMetrics.cornerRadius - 22.dp))
+ .outset(end = RequestDockMetrics.edge - RequestDockMetrics.headerTop)
.size(48.dp)
// iOS hint “Tells the agent what’s in your answer instead”: TalkBack reads “Double-tap to tell…”.
.clickable(enabled = enabled && idle && !busy, onClickLabel = "Tell the agent what’s in your answer instead", role = Role.Button) {
@@ -550,11 +549,10 @@ private class DockScope(
.testTag("request-dismiss"),
contentAlignment = Alignment.Center,
) {
+ // The desktop's ghost icon button: a bare glyph at rest (a filled square read as a
+ // second, heavier control beside the counter); the press ripple shows its target.
Box(
- Modifier
- .size(RequestDockMetrics.closeSize)
- .clip(OpenCodeShape.circle)
- .background(MaterialTheme.colorScheme.surfaceContainerHighest),
+ Modifier.size(RequestDockMetrics.closeSize),
contentAlignment = Alignment.Center,
) {
OpenCodeIcon(SFSymbol.Xmark, contentDescription = null, size = 16.dp, tint = colors.secondaryText)
@@ -1068,7 +1066,12 @@ private class DockScope(
onDismissRequest = { state.scopeShownForID = null },
properties = PopupProperties(focusable = true),
) {
- Surface(shape = OpenCodeShape.card, tonalElevation = 3.dp, shadowElevation = 8.dp) {
+ Surface(
+ shape = OpenCodeSurfaces.popoverShape,
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.popoverShadow,
+ ) {
PermissionScopeConfirm(save, confirm = {
state.scopeShownForID = null
state.sentAction = DockAction.Always
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/RequestReviewView.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/RequestReviewView.kt
index 3793ee47a..1775f321c 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/RequestReviewView.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/RequestReviewView.kt
@@ -1,5 +1,8 @@
package ai.opencode.feature.composer
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
+import ai.opencode.core.ui.OpenCodeSwitch
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.haptics.Haptic
import ai.opencode.core.haptics.HapticsClient
@@ -34,7 +37,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.ModalBottomSheet
-import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
@@ -82,6 +84,8 @@ fun RequestReviewSheet(
onDismissRequest = onClose,
sheetState = sheetState,
containerColor = OpenCodeTheme.colors.canvas,
+ dragHandle = { OpenCodeSheetHandle() },
+ shape = OpenCodeSheetDefaults.shape,
) {
RequestReviewView(dock, context, dismissMessage, send, onClose, onOpenURL)
}
@@ -219,7 +223,7 @@ private fun FormField(
}
Row(Modifier.fillMaxWidth().heightIn(min = 48.dp), verticalAlignment = Alignment.CenterVertically) {
Text("Completed", style = OpenCodeTextStyles.body, color = colors.text, modifier = Modifier.weight(1f))
- Switch(
+ OpenCodeSwitch(
checked = answers[field.key] == OpenCodeFormValue.Boolean(true),
onCheckedChange = { set(OpenCodeFormValue.Boolean(it)) },
enabled = enabled,
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/SharedLocation.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/SharedLocation.kt
index b30305e73..fbe9f15c2 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/SharedLocation.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/SharedLocation.kt
@@ -76,7 +76,7 @@ import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
@@ -529,7 +529,7 @@ fun SharedLocationCard(
val accuracy = if (compact) "" else location.accuracy?.let { " · ±${Math.round(it)} m" } ?: ""
Text(
location.coordinateText + accuracy,
- style = OpenCodeTextStyles.caption2.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.caption2.copy(fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.tertiaryText,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerController.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerController.kt
index 9488e4188..fec3c4748 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerController.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerController.kt
@@ -536,15 +536,15 @@ class OnePickerController {
}
companion object {
- /** iOS `ComposerTunables.cornerRadius` (session's composer capsule; 28 as shipped). */
- const val COMPOSER_CORNER_RADIUS = 28.0
+ /** `ComposerTunables.cornerRadius`: the desktop dock's 12 on Android (iOS's capsule is 28). */
+ const val COMPOSER_CORNER_RADIUS = 12.0
private val IDLE_POSE = OnePickerSimulation.FramePose(
rect = Rect.Zero,
targetRect = Rect.Zero,
layoutSize = Size.Zero,
- topRadius = 28.0,
- bottomRadius = 28.0,
+ topRadius = COMPOSER_CORNER_RADIUS,
+ bottomRadius = COMPOSER_CORNER_RADIUS,
contentReveal = 0.0,
searchBarReveal = 0.0,
glassOpacity = 0.0,
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerSurface.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerSurface.kt
index 1e13db822..d097de623 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerSurface.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerSurface.kt
@@ -1,5 +1,11 @@
package ai.opencode.feature.composer.modelpicker
+import ai.opencode.core.ui.openCodeFieldContainer
+import ai.opencode.core.ui.OpenCodeTextFieldDefaults
+import ai.opencode.core.ui.OpenCodeShape
+import ai.opencode.core.ui.OpenCodeSheetHandleDefaults
+import ai.opencode.core.ui.OpenCodeSurfaces
+import ai.opencode.core.ui.openCodeHairline
import ai.opencode.core.haptics.Haptic
import ai.opencode.core.haptics.HapticEffect
import ai.opencode.core.ui.OpenCodeIcon
@@ -109,9 +115,12 @@ import kotlin.math.roundToInt
// tunables default. Coordinates are dp in the overlay's own space (the session's root box).
// The DEBUG-only probes (window space, glass, chip, composer, integrity readout) are n/a.
-/** One Picker's surface colour: the composer's (so the morph reads as one surface). */
+/**
+ * One Picker's surface colour: the composer's (so the morph reads as one surface), on this branch
+ * the desktop's floating surface with a hairline ring.
+ */
object OnePickerSurfaceDefaults {
- val color: Color @Composable get() = MaterialTheme.colorScheme.surfaceContainerHigh
+ val color: Color @Composable get() = OpenCodeSurfaces.color
}
/** iOS's swipe-to-favorite fill, `UIColor(red: 0.92, green: 0.68, blue: 0.10)`. */
@@ -141,8 +150,9 @@ fun OnePickerGlassBackdrop(controller: OnePickerController, modifier: Modifier =
.offset { IntOffset(rect.left.dp.roundToPx(), rect.top.dp.roundToPx()) }
.requiredSize(rect.width.dp, rect.height.dp)
.graphicsLayer { alpha = pose.glassOpacity.toFloat().coerceIn(0f, 1f) }
- .shadow(3.dp, shape, clip = false)
- .background(color, shape),
+ .shadow(OpenCodeSurfaces.popoverShadow, shape, clip = false)
+ .background(color, shape)
+ .openCodeHairline(shape),
)
}
}
@@ -709,8 +719,8 @@ private fun OnePickerGrabber(
Box(
Modifier
.padding(top = 3.dp)
- .size(36.dp, 5.dp)
- .background(OpenCodeTheme.colors.tertiaryText, CircleShape),
+ .size(OpenCodeSheetHandleDefaults.width, OpenCodeSheetHandleDefaults.height)
+ .background(OpenCodeSheetHandleDefaults.color, OpenCodeShape.capsule),
)
}
}
@@ -730,6 +740,7 @@ private fun OnePickerSearchBar(
finishInteractiveDrag: (Double, Double) -> Unit,
) {
val colors = OpenCodeTheme.colors
+ val fieldColors = OpenCodeTextFieldDefaults.colors()
val density = LocalDensity.current
val focusManager = LocalFocusManager.current
val text = state.modelFilter
@@ -770,20 +781,20 @@ private fun OnePickerSearchBar(
.fillMaxWidth()
.padding(start = 12.dp, end = 12.dp, top = 6.dp, bottom = 10.dp)
.height(44.dp)
- .background(colors.inlineCodeFill, CircleShape)
+ .openCodeFieldContainer(isFocused = focused)
.padding(start = 10.dp, end = if (hasTrailing) 2.dp else 14.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
- OpenCodeIcon(SFSymbol.Magnifyingglass, null, size = 20.dp, tint = colors.secondaryText)
+ OpenCodeIcon(SFSymbol.Magnifyingglass, null, size = OpenCodeTextFieldDefaults.iconSize, tint = fieldColors.icon)
Box(Modifier.weight(1f), contentAlignment = Alignment.CenterStart) {
- if (text.isEmpty()) Text("Search Models", style = OpenCodeTextStyles.body, color = colors.secondaryText, maxLines = 1)
+ if (text.isEmpty()) Text("Search Models", style = OpenCodeTextFieldDefaults.textStyle, color = fieldColors.placeholder, maxLines = 1)
BasicTextField(
value = text,
onValueChange = { onEvent(ModelPickerEvent.FilterChanged(it)) },
singleLine = true,
- textStyle = OpenCodeTextStyles.body.copy(color = colors.text),
- cursorBrush = SolidColor(colors.accent),
+ textStyle = OpenCodeTextFieldDefaults.textStyle.copy(color = colors.text),
+ cursorBrush = SolidColor(fieldColors.cursor),
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None, autoCorrectEnabled = false, imeAction = ImeAction.Go),
keyboardActions = KeyboardActions(onAny = { onSubmit() }),
modifier = Modifier
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerTunables.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerTunables.kt
index e795a56cc..6974a766e 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerTunables.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/OnePickerTunables.kt
@@ -83,10 +83,10 @@ object OnePickerTunables {
const val KEYBOARD_GAP = 6.0
/** "Top corners" (16…48). */
- const val TOP_RADIUS = 32.0
+ const val TOP_RADIUS = 16.0
/** "Bottom corners" (16…56). */
- const val BOTTOM_RADIUS = 46.0
+ const val BOTTOM_RADIUS = 16.0
/** "Row height" (44…62). */
const val ROW_HEIGHT = 50.0
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/PlainModelPickerSheet.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/PlainModelPickerSheet.kt
index 5d87829b0..614e15a26 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/PlainModelPickerSheet.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/modelpicker/PlainModelPickerSheet.kt
@@ -2,6 +2,10 @@
package ai.opencode.feature.composer.modelpicker
+import androidx.compose.ui.focus.onFocusChanged
+import ai.opencode.core.ui.openCodeFieldContainer
+import ai.opencode.core.ui.OpenCodeTextFieldDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeIconSize
import ai.opencode.core.ui.OpenCodeTextStyles
@@ -200,7 +204,7 @@ fun ModelPickerDetentsSheet(
OpenCodeBottomSheet(
onDismissRequest = { currentOnClose() },
sheetState = sheetState,
- dragHandle = { Box(probe) { BottomSheetDefaults.DragHandle() } },
+ dragHandle = { Box(probe) { OpenCodeSheetHandle() } },
) {
// UIKit lifts a medium sheet when Search brings up the keyboard. Keep that expanded
// rest after the keyboard goes, but don't fight a subsequent drag back down.
@@ -410,7 +414,7 @@ fun ModelPickerChip(
}
/**
- * A magnifier, the placeholder, and a Clear button while there's text, in a tertiary-fill capsule:
+ * A magnifier, the placeholder, and a Clear button while there's text, in the text field's container:
* the Today picker's search (iOS `ModelSearchCapsuleField`, deleted with Grow from Composer in
* 0fbb99f8; iOS's Today picker uses `.searchable`).
*/
@@ -450,30 +454,33 @@ internal fun ModelSearchCapsuleField(
onTextChange(it)
}
val textColor = OpenCodeTheme.colors.text
+ val fieldColors = OpenCodeTextFieldDefaults.colors()
+ var isFocused by remember { mutableStateOf(false) }
Row(
modifier
.fillMaxWidth()
.heightIn(min = minHeight.dp)
- .background(OpenCodeTheme.colors.inlineCodeFill, CircleShape)
+ .openCodeFieldContainer(isFocused = isFocused)
.padding(start = leadingPadding, end = if (input.isEmpty()) emptyTrailingPadding else clearTrailingPadding),
horizontalArrangement = Arrangement.spacedBy(spacing),
verticalAlignment = Alignment.CenterVertically,
) {
- OpenCodeIcon(SFSymbol.Magnifyingglass, null, size = 20.dp, tint = OpenCodeTheme.colors.secondaryText)
+ OpenCodeIcon(SFSymbol.Magnifyingglass, null, size = OpenCodeTextFieldDefaults.iconSize, tint = fieldColors.icon)
Box(Modifier.weight(1f), contentAlignment = Alignment.CenterStart) {
- if (input.isEmpty()) Text(placeholder, style = OpenCodeTextStyles.body, color = OpenCodeTheme.colors.secondaryText, maxLines = 1)
+ if (input.isEmpty()) Text(placeholder, style = OpenCodeTextFieldDefaults.textStyle, color = fieldColors.placeholder, maxLines = 1)
BasicTextField(
value = input,
onValueChange = changeText,
singleLine = true,
- textStyle = OpenCodeTextStyles.body.copy(color = textColor),
- cursorBrush = SolidColor(OpenCodeTheme.colors.accent),
+ textStyle = OpenCodeTextFieldDefaults.textStyle.copy(color = textColor),
+ cursorBrush = SolidColor(fieldColors.cursor),
// Autocorrection stays on: its suggestions keep the keyboard the message field's height.
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None, imeAction = imeAction),
keyboardActions = KeyboardActions(onAny = { onSubmit() }),
modifier = Modifier
.fillMaxWidth()
.let { if (focusRequester != null) it.focusRequester(focusRequester) else it }
+ .onFocusChanged { isFocused = it.isFocused }
.semantics { contentDescription = placeholder }
.testTag("model-search"),
)
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusMenuGlassSurface.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusMenuGlassSurface.kt
index 15518a01b..fdbef313a 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusMenuGlassSurface.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusMenuGlassSurface.kt
@@ -6,6 +6,7 @@ import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.touch.TouchRecovery
import ai.opencode.core.touch.rememberTouchRecovery
import ai.opencode.core.ui.AccessibilityFocusRequest
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.ui.rememberAccessibilityFocusRequest
import ai.opencode.feature.composer.AttachmentMenuAnchors
import ai.opencode.feature.composer.AttachmentMenuItem
@@ -27,7 +28,6 @@ import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -284,9 +284,10 @@ private fun PlusMenuWindowContent(
} else Modifier.clearAndSetSemantics {},
),
shape = shape,
- color = MaterialTheme.colorScheme.surfaceContainer,
- tonalElevation = 3.dp,
- shadowElevation = 6.dp,
+ // The desktop popover: the floating fill, a hairline ring and its small shadow.
+ color = OpenCodeSurfaces.color,
+ shadowElevation = OpenCodeSurfaces.popoverShadow,
+ border = OpenCodeSurfaces.border,
) {
Box(contentAlignment = Alignment.TopStart) {
// Carry the rows with the growing surface: cropping full-size rows with the frame
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusPhotoPill.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusPhotoPill.kt
index f3cbecd4d..dbfcee556 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusPhotoPill.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusPhotoPill.kt
@@ -101,7 +101,7 @@ fun PlusPhotoPill(
val p = progress.value.coerceIn(0f, 1f)
Box(modifier) {
Surface(
- shape = OpenCodeShape.capsule,
+ shape = OpenCodeShape.control,
// The label turns white and the fill accent over the first pick, not at its start.
color = lerp(idleFill, accent, p),
contentColor = lerp(idleText, Color.White, p),
diff --git a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusPhotoSheet.kt b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusPhotoSheet.kt
index 2b0aed189..bb5192793 100644
--- a/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusPhotoSheet.kt
+++ b/feature/composer/src/main/kotlin/ai/opencode/feature/composer/plusmenu/PlusPhotoSheet.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.composer.plusmenu
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandleDefaults
import ai.opencode.core.haptics.Haptic
import ai.opencode.core.haptics.HapticsClient
import ai.opencode.core.dependencies.AppContext
@@ -602,6 +604,7 @@ fun PlusPhotoSheet(
onDismissRequest = onDismiss,
sheetState = sheetState,
dragHandle = { PlusPhotoSheetGrabber(isExpanded = isExpanded, onToggle = ::toggleExpand) },
+ shape = OpenCodeSheetDefaults.shape,
) {
PhotoLibraryAccessHost()
var hiddenBottom by remember { mutableFloatStateOf(0f) }
@@ -691,9 +694,9 @@ private fun PlusPhotoSheetGrabber(
Box(
Modifier
.padding(top = (if (over) 7f + inset else 7f).dp)
- .size(width = 36.dp, height = 5.dp)
+ .size(width = OpenCodeSheetHandleDefaults.width, height = OpenCodeSheetHandleDefaults.height)
.then(if (over) Modifier.shadow(2.dp, OpenCodeShape.capsule, ambientColor = Color.Black.copy(alpha = 0.35f), spotColor = Color.Black.copy(alpha = 0.35f)) else Modifier)
- .background(if (over) Color.White.copy(alpha = 0.8f) else OpenCodeTheme.colors.tertiaryText, OpenCodeShape.capsule),
+ .background(if (over) Color.White.copy(alpha = 0.8f) else OpenCodeSheetHandleDefaults.color, OpenCodeShape.capsule),
)
}
}
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/HomeViewDrawer.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/HomeViewDrawer.kt
index 9881e11f8..8770c0a6d 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/HomeViewDrawer.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/HomeViewDrawer.kt
@@ -1,5 +1,9 @@
package ai.opencode.feature.drawer
+import ai.opencode.core.ui.OpenCodeSurfaces
+import ai.opencode.core.ui.OpenCodeRadius
+import androidx.compose.foundation.shape.RoundedCornerShape
+import ai.opencode.feature.drawer.style.drawerCanvas
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.experiments.key
import ai.opencode.core.motion.rememberReduceMotion
@@ -9,7 +13,6 @@ import ai.opencode.core.store.observe
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeIconButton
import ai.opencode.core.ui.OpenCodeIconButtonStyle
-import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.core.ui.SFSymbol
@@ -79,7 +82,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.union
-import androidx.compose.material3.AlertDialog
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@@ -230,7 +233,7 @@ fun HomeDrawer(
Box(
modifier
.fillMaxSize()
- .background(colors.canvas)
+ .background(colors.drawerCanvas)
// TalkBack reads top to bottom, as VoiceOver reads iOS's header inset, list and bottom
// bar: the title and search, the list, then New Session and Settings. The bands lie
// over the full-height list, so without an order TalkBack read the controls first.
@@ -427,7 +430,7 @@ private fun rowMenu(store: StoreOf, row:
fun HomeDeleteConfirmation(store: StoreOf) {
val pending by store.observe { it.pendingDeletion }
val session = pending ?: return
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { store.send(HomeFeature.Action.DeleteSessionCancelled) },
title = { Text("Delete “" + session.title + "”?") },
text = { Text("This removes the session from the server for all clients.") },
@@ -460,8 +463,12 @@ private fun DrawerNewSessionButton(enabled: Boolean, onClick: () -> Unit) {
val rise = DrawerTunables.footerGlyphRise.value * glyph / 17f
val tint = if (enabled) colors.text else colors.tertiaryText
Surface(
- shape = OpenCodeShape.capsule,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
+ // The desktop's floating control: the popover fill, hairline ring and a soft shadow, at the
+ // floating panels' radius so the tall footer buttons don't read as keys.
+ shape = RoundedCornerShape(OpenCodeRadius.panel),
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
contentColor = tint,
modifier = Modifier
.clickable(enabled = enabled, role = Role.Button, onClick = onClick)
@@ -490,7 +497,7 @@ private fun DrawerNewSessionButton(enabled: Boolean, onClick: () -> Unit) {
)
Text(
"New Session",
- style = OpenCodeTextStyles.body.copy(fontWeight = FontWeight.SemiBold),
+ style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.Medium),
color = tint,
maxLines = 1,
)
@@ -544,8 +551,10 @@ private fun DrawerFooterTrailing(
}
}
Surface(
- shape = OpenCodeShape.capsule,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
+ shape = RoundedCornerShape(OpenCodeRadius.panel),
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
contentColor = OpenCodeTheme.colors.text,
) {
Row(verticalAlignment = Alignment.CenterVertically) {
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpChrome.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpChrome.kt
index 3a104867e..f0c53ee8a 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpChrome.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpChrome.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.drawer.catchup
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.motion.Motion
import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.ui.AccessibilityFocusRequest
@@ -172,12 +173,14 @@ private fun CatchUpUndoButton(canUndo: Boolean, onClick: () -> Unit) {
FilledTonalButton(
onClick = onClick,
enabled = canUndo,
- shape = OpenCodeShape.capsule,
+ shape = OpenCodeShape.control,
+ // The desktop's neutral button: base surface and a hairline.
+ border = androidx.compose.foundation.BorderStroke(1.dp, OpenCodeTheme.colors.border),
contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 16.dp),
colors = ButtonDefaults.filledTonalButtonColors(
- containerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
+ containerColor = OpenCodeSurfaces.neutralFill,
contentColor = OpenCodeTheme.colors.text,
- disabledContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
+ disabledContainerColor = OpenCodeSurfaces.neutralFill,
disabledContentColor = OpenCodeTheme.colors.tertiaryText,
),
modifier = Modifier.heightIn(min = OpenCodeMinTapTarget).widthIn(min = OpenCodeMinTapTarget),
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpStack.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpStack.kt
index 551210732..72542ac3c 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpStack.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpStack.kt
@@ -470,7 +470,8 @@ private class CatchUpCardSurfaceNode(
activeLayer.setRoundRectOutline(Offset.Zero, size, cornerRadius.toPx())
activeLayer.clip = true
if (shadow) {
- activeLayer.shadowElevation = 16.dp.toPx()
+ // The desktop overlay elevation: softer than Material's 16 dp lift.
+ activeLayer.shadowElevation = 8.dp.toPx()
activeLayer.ambientShadowColor = FlyingShadowColor
activeLayer.spotShadowColor = FlyingShadowColor
} else {
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpTunables.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpTunables.kt
index 11cef9073..fab7f5c8d 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpTunables.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/catchup/CatchUpTunables.kt
@@ -57,8 +57,8 @@ object CatchUpTunables {
const val revealFraction = 0.78f
// Card
- /** Card corner radius. */
- const val cornerRadius = 40f
+ /** Card corner radius (the desktop's 16 for large panels; iOS follows the screen's 40). */
+ const val cornerRadius = 16f
/** Drag rotation (rad). */
const val dragRotation = 0.16f
/** Card side inset. */
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListServerFlowCells.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListServerFlowCells.kt
index 95a70f8f5..8e157b164 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListServerFlowCells.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListServerFlowCells.kt
@@ -1,5 +1,8 @@
package ai.opencode.feature.drawer.list
+import ai.opencode.core.ui.openCodeHairline
+import ai.opencode.core.ui.OpenCodeRadius
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodePrimaryButton
import ai.opencode.core.ui.OpenCodeTextStyles
@@ -122,7 +125,9 @@ fun DrawerServerNoteRow(note: ServerSwitchNote, onAction: () -> Unit, modifier:
.padding(horizontal = DrawerMetrics.rowEdge)
.padding(top = 4.dp, bottom = 8.dp)
.fillMaxWidth()
- .background(MaterialTheme.colorScheme.surfaceContainerHigh, RoundedCornerShape(22.dp))
+ // The desktop card: floating fill, hairline ring, small radius.
+ .background(OpenCodeSurfaces.color, RoundedCornerShape(OpenCodeRadius.card))
+ .openCodeHairline(RoundedCornerShape(OpenCodeRadius.card))
.padding(horizontal = 16.dp, vertical = 14.dp)
.testTag("drawer-server-note"),
verticalArrangement = Arrangement.spacedBy(2.dp),
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListSessionCell.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListSessionCell.kt
index 68554632e..88fee592f 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListSessionCell.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListSessionCell.kt
@@ -392,7 +392,7 @@ fun DrawerListSessionCell(
SFSymbol.CircleFill,
contentDescription = null,
size = (11 * density.fontScale).dp,
- tint = if (row.indicator == Indicator.attention) DrawerListSessionCell.attentionColor(colors.isDark) else colors.accent,
+ tint = if (row.indicator == Indicator.attention) DrawerListSessionCell.attentionColor(colors.isDark) else colors.signal,
modifier = Modifier.graphicsLayer { alpha = dotAlpha },
)
}
@@ -416,9 +416,9 @@ private fun SelectionMark(selection: DrawerSelectionStyle?, cornerRadius: Dp) {
.drawBehind {
val radius = CornerRadius(cornerRadius.toPx())
when (selection) {
- // Android: the shipped mark is Material's navigation drawer indicator, a
- // secondary-container capsule, where iOS fills the row with a faint grey.
- DrawerSelectionStyle.Fill -> drawRoundRect(indicator, cornerRadius = CornerRadius(size.height / 2))
+ // The desktop sidebar's active row: a faint pressed overlay
+ // (`--v2-overlay-simple-overlay-pressed`) in the row's small radius.
+ DrawerSelectionStyle.Fill -> drawRoundRect(colors.text.copy(alpha = if (colors.isDark) 0.10f else 0.07f), cornerRadius = radius)
DrawerSelectionStyle.Tint -> drawRoundRect(colors.accent, cornerRadius = radius)
DrawerSelectionStyle.Outline -> {
val inset = 0.5.dp.toPx()
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListSupportCells.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListSupportCells.kt
index a5356b60c..7dd36fd51 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListSupportCells.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/DrawerListSupportCells.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.drawer.list
+import ai.opencode.feature.drawer.style.drawerCanvas
import ai.opencode.core.motion.transitionBlurEffect
import ai.opencode.core.ui.AccessibilityFocusRequest
@@ -202,7 +203,7 @@ private fun CatchUpButton(
returnFocus: AccessibilityFocusRequest?,
) {
val shape = RoundedCornerShape(DrawerMetrics.rowCornerRadius)
- val canvas = OpenCodeTheme.colors.canvas
+ val canvas = OpenCodeTheme.colors.drawerCanvas
RecentRowMenu(
enabled = canMarkAllRead,
onClick = openCatchUp,
@@ -250,7 +251,7 @@ private fun CatchUpButton(
@Composable
fun DrawerWhatsNewButton(action: () -> Unit, onHide: () -> Unit, modifier: Modifier = Modifier) {
val shape = RoundedCornerShape(DrawerMetrics.rowCornerRadius)
- val canvas = OpenCodeTheme.colors.canvas
+ val canvas = OpenCodeTheme.colors.drawerCanvas
RecentRowMenu(
enabled = true,
onClick = action,
@@ -278,7 +279,7 @@ fun DrawerWhatsNewButton(action: () -> Unit, onHide: () -> Unit, modifier: Modif
SFSymbol.CircleFill,
contentDescription = null,
size = (11 * LocalDensity.current.fontScale).dp,
- tint = OpenCodeTheme.colors.accent,
+ tint = OpenCodeTheme.colors.signal,
modifier = Modifier.height(18.dp),
)
}
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/InboxSidebarList.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/InboxSidebarList.kt
index 40f42eeb1..a66bc1a49 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/InboxSidebarList.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/list/InboxSidebarList.kt
@@ -157,7 +157,7 @@ internal fun InboxSidebarList(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
- OpenCodeIcon(SFSymbol.RectangleStack, contentDescription = null, tint = colors.accent)
+ OpenCodeIcon(SFSymbol.RectangleStack, contentDescription = null, tint = colors.signal)
Text("Catch Up", style = OpenCodeTextStyles.body, color = colors.text, modifier = Modifier.weight(1f))
Text("$catchUpCount", style = OpenCodeTextStyles.body.copy(fontFeatureSettings = "tnum"), color = colors.secondaryText)
}
@@ -282,7 +282,7 @@ internal fun InboxSidebarRowView(row: InboxSidebarRow, now: Instant, modifier: M
Modifier
.padding(top = 7.dp)
.size(8.dp)
- .background(if (row.unread) colors.accent else Color.Transparent, CircleShape),
+ .background(if (row.unread) colors.signal else Color.Transparent, CircleShape),
)
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
// iOS: Text + Spacer(minLength: 8) + age. The title takes all the width the age
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/motion/DrawerButton.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/motion/DrawerButton.kt
index f4647e1bb..23d663e6f 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/motion/DrawerButton.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/motion/DrawerButton.kt
@@ -439,7 +439,7 @@ private fun DrawerButtonCapsule(
label = "drawer-button-fill",
)
Surface(
- shape = OpenCodeShape.capsule,
+ shape = OpenCodeShape.control,
color = fill,
contentColor = OpenCodeTheme.colors.text,
modifier = widthModifier
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/motion/DrawerSearchPill.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/motion/DrawerSearchPill.kt
index be3cfe8c9..62e294e7f 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/motion/DrawerSearchPill.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/motion/DrawerSearchPill.kt
@@ -1,5 +1,8 @@
package ai.opencode.feature.drawer.motion
+import ai.opencode.core.ui.OpenCodeSurfaces
+import androidx.compose.foundation.shape.RoundedCornerShape
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.haptics.Haptic
import ai.opencode.core.haptics.HapticsClient
@@ -9,7 +12,6 @@ import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeMinTapTarget
import ai.opencode.feature.drawer.style.DrawerMetrics
import ai.opencode.feature.drawer.style.DrawerTunables
-import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.core.ui.SFSymbol
@@ -281,8 +283,11 @@ private fun SearchCapsule(
val leading by animateFloatAsState(leadingPadding.value, DrawerSearchPillDefaults.morph.spec(), label = "search-leading")
val trailing by animateFloatAsState(trailingPadding.value, DrawerSearchPillDefaults.morph.spec(), label = "search-trailing")
Surface(
- shape = OpenCodeShape.capsule,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
+ // The drawer's floating control, as its footer buttons: popover fill, hairline ring, soft shadow.
+ shape = RoundedCornerShape(OpenCodeRadius.panel),
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
contentColor = OpenCodeTheme.colors.text,
modifier = modifier
.height(size)
@@ -328,8 +333,10 @@ private fun SearchCapsule(
@Composable
private fun CancelButton(size: Dp, enabled: Boolean = true, onClick: () -> Unit) {
Surface(
- shape = OpenCodeShape.circle,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
+ shape = RoundedCornerShape(OpenCodeRadius.panel),
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
contentColor = OpenCodeTheme.colors.text,
modifier = Modifier
.size(size)
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/style/DrawerBackdrops.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/style/DrawerBackdrops.kt
index 9e1270a77..6c3bdcf04 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/style/DrawerBackdrops.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/style/DrawerBackdrops.kt
@@ -73,7 +73,7 @@ fun DrawerHeaderBackdrop(
modifier: Modifier = Modifier,
revealed: Float = 1f,
scrollState: DrawerHeaderScrollState? = null,
- background: Color = OpenCodeTheme.colors.canvas,
+ background: Color = OpenCodeTheme.colors.drawerCanvas,
) {
Spacer(
modifier
@@ -151,7 +151,7 @@ fun DrawerFooterBackdrop(
reach: Dp,
insetBottom: Dp,
modifier: Modifier = Modifier,
- background: Color = OpenCodeTheme.colors.canvas,
+ background: Color = OpenCodeTheme.colors.drawerCanvas,
) {
Spacer(
modifier
diff --git a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/style/DrawerStyle.kt b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/style/DrawerStyle.kt
index 66d8e7564..b4c8ce99f 100644
--- a/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/style/DrawerStyle.kt
+++ b/feature/drawer/src/main/kotlin/ai/opencode/feature/drawer/style/DrawerStyle.kt
@@ -4,6 +4,7 @@ import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.tuning.Tunable
import ai.opencode.core.tuning.TunableSpring
import ai.opencode.core.tuning.TuningStore
+import ai.opencode.core.ui.AppTheme
import ai.opencode.core.ui.OpenCodeColors
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeIconSize
@@ -225,9 +226,9 @@ object DrawerTunables {
/** Status inside the highlight. */
val trailingInset: Dp = 12.dp
/** Highlight corner radius. */
- val rowCornerRadius: Dp = 10.dp
+ val rowCornerRadius: Dp = 6.dp
/** Row text. */
- val rowFont: DrawerTextStyle = DrawerTextStyle.Body
+ val rowFont: DrawerTextStyle = DrawerTextStyle.Subheadline
/** Room above a header. */
val sectionAbove: Dp = 18.dp
/** Header height. */
@@ -451,7 +452,7 @@ fun DrawerShortcutLabel(
sfName = systemImage,
contentDescription = null,
size = OpenCodeIconSize.medium * symbolScale,
- tint = OpenCodeTheme.colors.accent,
+ tint = OpenCodeTheme.colors.signal,
)
}
ProvideTextStyle(DrawerTunables.rowFont.font) {
@@ -620,3 +621,10 @@ val DrawerRowShape: RoundedCornerShape get() = RoundedCornerShape(DrawerMetrics.
/** iOS XXXL body (23 pt) over Large (17 pt): where shortcut symbols stop growing. */
internal const val XXXL_FONT_SCALE = 23f / 17f
+
+/**
+ * The drawer's canvas: the desktop sidebar's `--v2-background-bg-deep`, a step off the session's
+ * canvas. The System theme keeps the plain canvas (its dynamic colours have no such step).
+ */
+val OpenCodeColors.drawerCanvas: Color
+ get() = if (theme == AppTheme.System) canvas else variant.canvasWeak.color
diff --git a/feature/drawer/src/test/kotlin/ai/opencode/feature/drawer/style/TuningTests.kt b/feature/drawer/src/test/kotlin/ai/opencode/feature/drawer/style/TuningTests.kt
index 2993b9dfc..46372c7aa 100644
--- a/feature/drawer/src/test/kotlin/ai/opencode/feature/drawer/style/TuningTests.kt
+++ b/feature/drawer/src/test/kotlin/ai/opencode/feature/drawer/style/TuningTests.kt
@@ -49,13 +49,15 @@ class DrawerSpacingTests {
/** What the drawer ships: D-66's Sidebar Grey spacing. */
@Test
fun defaultsAreWhatShipped() {
+ // Android diverges from iOS on purpose: the drawer follows the OpenCode desktop sidebar
+ // (6 dp row radius, 14 sp subheadline rows). Everything else is iOS's.
val shipped: List> = listOf(
Triple("drawer.row.height", DrawerTunables.rowHeight, 44f),
Triple("drawer.row.gap", DrawerTunables.rowGap, 0f),
Triple("drawer.row.edge", DrawerTunables.rowEdge, 10f),
Triple("drawer.row.textInset", DrawerTunables.textInset, 10f),
Triple("drawer.row.trailingInset", DrawerTunables.trailingInset, 12f),
- Triple("drawer.row.cornerRadius", DrawerTunables.rowCornerRadius, 10f),
+ Triple("drawer.row.cornerRadius", DrawerTunables.rowCornerRadius, 6f),
Triple("drawer.section.above", DrawerTunables.sectionAbove, 18f),
Triple("drawer.section.height", DrawerTunables.sectionHeight, 34f),
Triple("drawer.section.below", DrawerTunables.sectionBelow, 4f),
@@ -83,7 +85,7 @@ class DrawerSpacingTests {
assertEquals(DrawerEdgeCurve.Smoothstep, DrawerTunables.bottomBlurCurve)
assertEquals(DrawerEdgeStyle.Soft, DrawerTunables.bottomEdge)
assertEquals(DrawerBottomEdgeMode.System, DrawerTunables.bottomMode)
- assertEquals(DrawerTextStyle.Body, DrawerTunables.rowFont)
+ assertEquals(DrawerTextStyle.Subheadline, DrawerTunables.rowFont)
// D-66 Sidebar Grey: headline secondary headers and a title-size title,
// with D-51's medium unread and waiting rows, read rows at 86% and a
// 15 pt Catch Up count.
@@ -100,7 +102,7 @@ class DrawerSpacingTests {
assertEquals(10.dp, DrawerMetrics.textInset)
assertEquals(12.dp, DrawerMetrics.trailingInset)
assertEquals(20.dp, DrawerMetrics.leadingEdge)
- assertEquals(10.dp, DrawerMetrics.rowCornerRadius)
+ assertEquals(6.dp, DrawerMetrics.rowCornerRadius)
assertEquals(44.dp, DrawerMetrics.rowHeight)
}
diff --git a/feature/media/src/debug/kotlin/ai/opencode/feature/media/lab/MediaLabActivity.kt b/feature/media/src/debug/kotlin/ai/opencode/feature/media/lab/MediaLabActivity.kt
index b929aa776..dc0956ab4 100644
--- a/feature/media/src/debug/kotlin/ai/opencode/feature/media/lab/MediaLabActivity.kt
+++ b/feature/media/src/debug/kotlin/ai/opencode/feature/media/lab/MediaLabActivity.kt
@@ -101,7 +101,7 @@ import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.buildAnnotatedString
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.withLink
@@ -347,7 +347,7 @@ private fun paragraph(source: String): Paragraph {
false -> {
val code = match.groupValues[1]
AgentFileReference.fromInlineCode(code)?.let { files += it }
- withStyle(SpanStyle(fontFamily = FontFamily.Monospace)) { append(code) }
+ withStyle(SpanStyle(fontFamily = OpenCodeFonts.monospace)) { append(code) }
runs += LinkTextRun(code, isCode = true)
}
null -> {
@@ -407,7 +407,7 @@ private fun LabReply(
is Piece.Code -> if (piece.language == "mermaid") {
if (section == null || section == "mermaid") MermaidDiagramCard(piece.source, onPreview = { presenter?.presentImage(it) })
} else if (section == null) {
- Text(piece.source, style = OpenCodeTextStyles.footnote.copy(fontFamily = FontFamily.Monospace), color = OpenCodeTheme.colors.text)
+ Text(piece.source, style = OpenCodeTextStyles.footnote.copy(fontFamily = OpenCodeFonts.monospace), color = OpenCodeTheme.colors.text)
}
is Piece.Prose -> {
paragraph ?: continue
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/MediaFoundation.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/MediaFoundation.kt
index efbeea9d0..5f979fcfc 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/MediaFoundation.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/MediaFoundation.kt
@@ -24,21 +24,21 @@ object TranscriptMetrics {
val compact: Dp = 4.dp
val clustered: Dp = 8.dp
/** `transcript.bubble.verticalPadding` default. */
- val bubbleVertical: Dp = 10.dp
+ val bubbleVertical: Dp = 8.dp
val standard: Dp = 12.dp
/** `transcript.row.contentGutter` default. */
val contentGutter: Dp = 16.dp
val turn: Dp = 20.dp
/** `transcript.bubble.cornerRadius` default. */
- val bubbleCornerRadius: Dp = 18.dp
+ val bubbleCornerRadius: Dp = 10.dp
/** Content surfaces: code, tables, cards, and images (`transcript.card.cornerRadius` default). */
- val cardCornerRadius: Dp = 14.dp
+ val cardCornerRadius: Dp = 8.dp
/** Controls inside sheets and cards: choices and fields. */
- val controlCornerRadius: Dp = 10.dp
+ val controlCornerRadius: Dp = 6.dp
/** `transcript.bubble.maxFraction` default. */
- const val maximumUserBubbleFraction: Float = 0.78f
+ const val maximumUserBubbleFraction: Float = 0.82f
/** The widest the transcript and composer grow, gutters included (tablets centre at it). */
val readableColumnWidth: Dp = 720.dp
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/TranscriptImageViewer.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/TranscriptImageViewer.kt
index 31935052a..65f20d382 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/TranscriptImageViewer.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/TranscriptImageViewer.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.media
+import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.dependencies.AppContext
import ai.opencode.core.dependencies.DependencyKey
import ai.opencode.core.dependencies.dependency
@@ -560,7 +561,7 @@ fun TranscriptImageViewer(
modifier = Modifier.align(Alignment.BottomEnd).padding(end = 16.dp, bottom = 16.dp),
) {
Surface(
- shape = RoundedCornerShape(percent = 50),
+ shape = OpenCodeShape.control,
color = MaterialTheme.colorScheme.surfaceContainerHighest,
contentColor = Color.White,
) {
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentCodeView.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentCodeView.kt
index 37d48e1db..799c961b1 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentCodeView.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentCodeView.kt
@@ -30,7 +30,7 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.rememberTextMeasurer
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
@@ -44,10 +44,10 @@ private val FocusLineBackground = Color(red = 1f, green = 0.8f, blue = 0f, alpha
private val MaxUnwrappedWidth: Dp = 16_384.dp
/** iOS `TranscriptMetrics.codeFont`: subheadline, monospaced. */
-private val NumberedCodeStyle: TextStyle = OpenCodeTextStyles.subheadline.copy(fontFamily = FontFamily.Monospace)
+private val NumberedCodeStyle: TextStyle = OpenCodeTextStyles.subheadline.copy(fontFamily = OpenCodeFonts.monospace)
/** iOS `AgentTextDocument.codeUIFont`: footnote 13, monospaced. */
-private val LazyCodeStyle: TextStyle = OpenCodeTextStyles.footnote.copy(fontFamily = FontFamily.Monospace)
+private val LazyCodeStyle: TextStyle = OpenCodeTextStyles.footnote.copy(fontFamily = OpenCodeFonts.monospace)
/**
* Highlighted source with line numbers for small files, or a lazy unnumbered list of lines for
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentFileViewer.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentFileViewer.kt
index 63987c6e2..d1b333925 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentFileViewer.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentFileViewer.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.media
+import ai.opencode.core.ui.OpenCodeTopBar
import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.sharing.SharedKeys
import ai.opencode.core.sharing.shared
@@ -42,8 +43,7 @@ import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
-import androidx.compose.material3.AlertDialog
-import androidx.compose.material3.CenterAlignedTopAppBar
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.IconButton
@@ -53,7 +53,6 @@ import androidx.compose.material3.Slider
import androidx.compose.material3.SliderDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
-import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
@@ -245,10 +244,13 @@ private fun AgentFilePageContent(
modifier = modifier.fillMaxSize(),
containerColor = background,
topBar = {
- CenterAlignedTopAppBar(
- colors = TopAppBarDefaults.centerAlignedTopAppBarColors(containerColor = background),
+ OpenCodeTopBar(
+ containerColor = background,
+ centerTitle = true,
+ // Over a photo or video the bar is just its controls, as the media viewer's.
+ hairline = !reference.kind.isMedia,
title = { AgentFileTitle(reference.name, model.locationLabel) },
- navigationIcon = {
+ navigation = {
if (isRoot) {
TextButton(onClick = onDone, modifier = Modifier.testTag("agent-file-done")) { Text("Done") }
} else {
@@ -309,7 +311,7 @@ private fun AgentFilePageContent(
}
model.shareError?.let { error ->
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { model.shareError = null },
title = { Text("Couldn’t Share File") },
text = { Text(error.detail) },
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentImageBento.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentImageBento.kt
index b3acdf143..08dad467f 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentImageBento.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentImageBento.kt
@@ -313,7 +313,7 @@ class AgentImageBento(
/** A tile cropping more than this shows its image whole instead ([fits]). */
const val MAX_CROP = 0.3
/** iOS `JustifiedImageRows.cornerRadius`. */
- val defaultCornerRadius: Dp = 14.dp
+ val defaultCornerRadius: Dp = TranscriptMetrics.cardCornerRadius
/** The corners of `frame` that lie on the bento's own corners. */
fun corners(frame: BentoRect, width: Double, height: Double): BentoCorners {
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentImageGallery.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentImageGallery.kt
index 854c47b61..04efdae63 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentImageGallery.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentImageGallery.kt
@@ -56,7 +56,7 @@ import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.semantics.testTag
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
@@ -734,7 +734,7 @@ fun AgentImageStatusCard(file: AgentFileReference, status: AgentImageStatusCard.
)
Text(
file.path,
- style = OpenCodeTextStyles.caption1.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.caption1.copy(fontFamily = OpenCodeFonts.monospace),
color = if (notFound) colors.tertiaryText else colors.secondaryText,
maxLines = 1,
overflow = TextOverflow.MiddleEllipsis,
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/browser/BrowserView.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/browser/BrowserView.kt
index 1a21c348d..23e9ad077 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/browser/BrowserView.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/browser/BrowserView.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.media
+import ai.opencode.core.ui.OpenCodeRadius
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.motion.Motion
import ai.opencode.core.scene.ActiveScene
@@ -189,10 +191,12 @@ fun BrowserPage(
// Where the drawer button sits on the session: back to it.
Surface(
onClick = ::close,
- shape = CircleShape,
+ shape = RoundedCornerShape(OpenCodeRadius.card),
contentColor = OpenCodeTheme.colors.text,
- tonalElevation = 3.dp,
- shadowElevation = 2.dp,
+ // The desktop floating surface: flat fill, hairline ring.
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
modifier = Modifier
.windowInsetsPadding(WindowInsets.safeDrawing.union(WindowInsets.statusBars))
.padding(start = 12.dp, top = TranscriptMetrics.clustered)
@@ -271,9 +275,11 @@ private fun Bar(store: StoreOf, pag
val isAsking = page?.isAsking == true
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {
Surface(
- shape = OpenCodeShape.capsule,
- tonalElevation = 3.dp,
- shadowElevation = 2.dp,
+ shape = OpenCodeShape.control,
+ // The desktop floating surface: flat fill, hairline ring.
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
modifier = Modifier
.weight(1f)
.height(BrowserMetrics.barHeight),
@@ -299,9 +305,11 @@ private fun Bar(store: StoreOf, pag
}
Surface(
onClick = { store.send(if (isAsking) BrowserFeature.Action.AskDismissed else BrowserFeature.Action.AskTapped) },
- shape = CircleShape,
- tonalElevation = 3.dp,
- shadowElevation = 2.dp,
+ shape = RoundedCornerShape(OpenCodeRadius.card),
+ // The desktop floating surface: flat fill, hairline ring.
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
modifier = Modifier
.size(BrowserMetrics.barHeight)
.semantics { contentDescription = if (isAsking) "Cancel" else "Ask About This Page" }
@@ -388,9 +396,11 @@ private fun AskComposer(
store.send(BrowserFeature.Action.AskSent)
}
Surface(
- shape = RoundedCornerShape(BrowserMetrics.barHeight / 2),
- tonalElevation = 3.dp,
- shadowElevation = 2.dp,
+ shape = RoundedCornerShape(OpenCodeRadius.panel),
+ // The desktop floating surface: flat fill, hairline ring.
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
modifier = Modifier.fillMaxWidth().heightIn(min = BrowserMetrics.barHeight),
) {
Row(verticalAlignment = Alignment.Bottom) {
@@ -464,9 +474,11 @@ private fun ReplyCapsule(
BrowserReplyStatus.Working -> "Working"
}
Surface(
- shape = OpenCodeShape.capsule,
- tonalElevation = 3.dp,
- shadowElevation = 2.dp,
+ shape = OpenCodeShape.control,
+ // The desktop floating surface: flat fill, hairline ring.
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
modifier = Modifier
.heightIn(min = BrowserMetrics.controlSize)
.then(if (goesBack) Modifier.clickable(role = Role.Button, onClickLabel = "Go back to the session", onClick = close) else Modifier)
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/browser/LinkMenu.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/browser/LinkMenu.kt
index 491ad3ac3..d92881b43 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/browser/LinkMenu.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/browser/LinkMenu.kt
@@ -69,7 +69,7 @@ import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.TextPainter
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.IntOffset
@@ -875,7 +875,7 @@ fun LinkPreviewCardContent(url: String, modifier: Modifier = Modifier) {
Text(SessionLink.title(url) ?: "Session", style = OpenCodeTextStyles.headline, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(
sessionID,
- style = OpenCodeTextStyles.footnote.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.footnote.copy(fontFamily = OpenCodeFonts.monospace),
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
overflow = TextOverflow.MiddleEllipsis,
diff --git a/feature/media/src/main/kotlin/ai/opencode/feature/media/mermaid/MermaidDiagramView.kt b/feature/media/src/main/kotlin/ai/opencode/feature/media/mermaid/MermaidDiagramView.kt
index 60e5d3bf1..d34063d93 100644
--- a/feature/media/src/main/kotlin/ai/opencode/feature/media/mermaid/MermaidDiagramView.kt
+++ b/feature/media/src/main/kotlin/ai/opencode/feature/media/mermaid/MermaidDiagramView.kt
@@ -64,7 +64,7 @@ import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@@ -295,7 +295,7 @@ private fun MermaidCode(source: String, modifier: Modifier = Modifier) {
/** iOS `TranscriptMetrics.codeFont`: subheadline, monospaced. */
@Composable
-private fun codeStyle() = OpenCodeTextStyles.subheadline.copy(fontFamily = FontFamily.Monospace)
+private fun codeStyle() = OpenCodeTextStyles.subheadline.copy(fontFamily = OpenCodeFonts.monospace)
/** A diagram's Mermaid source, highlighted and selectable (iOS `MermaidSourceView`). */
@Composable
diff --git a/feature/session/src/main/kotlin/ai/opencode/feature/session/BackgroundWorkMotion.kt b/feature/session/src/main/kotlin/ai/opencode/feature/session/BackgroundWorkMotion.kt
index 8c7efdab7..9711cb842 100644
--- a/feature/session/src/main/kotlin/ai/opencode/feature/session/BackgroundWorkMotion.kt
+++ b/feature/session/src/main/kotlin/ai/opencode/feature/session/BackgroundWorkMotion.kt
@@ -88,7 +88,8 @@ object BackgroundWorkMotion {
val resize: MotionSpring get() = BackgroundWorkTunables.resize
const val capsuleInset: Float = 5f
- const val panelRadius: Float = 28f
+ /** The desktop dock's 12 (iOS's glass is 28): the capsule is a 34 dp chip with 12 dp corners. */
+ const val panelRadius: Float = 12f
}
/**
diff --git a/feature/session/src/main/kotlin/ai/opencode/feature/session/BackgroundWorkPanel.kt b/feature/session/src/main/kotlin/ai/opencode/feature/session/BackgroundWorkPanel.kt
index 7af99ad69..ef24b5f0c 100644
--- a/feature/session/src/main/kotlin/ai/opencode/feature/session/BackgroundWorkPanel.kt
+++ b/feature/session/src/main/kotlin/ai/opencode/feature/session/BackgroundWorkPanel.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.session
+import ai.opencode.core.ui.openCodeHairline
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.diagnostics.LabMarks
import ai.opencode.core.haptics.Haptic
@@ -396,7 +398,7 @@ fun BackgroundWorkGlyph(
// MARK: Presentation
-/** The surface's shape: the panel's 28 dp corners, never more than half its height (iOS `GlassGeometry.radius`). */
+/** The surface's shape: the panel's corners ([BackgroundWorkMotion.panelRadius]), never more than half its height (iOS `GlassGeometry.radius`). */
private class BackgroundWorkShape(private val radius: Float) : Shape {
override fun createOutline(size: Size, layoutDirection: LayoutDirection, density: Density): Outline {
val r = min(max(0f, radius * density.density), max(0f, size.height) / 2)
@@ -765,7 +767,7 @@ fun BackgroundWorkPresentation(
val hidden = isCovered
val hiddenAlpha by androidx.compose.animation.core.animateFloatAsState(if (hidden) 0f else 1f, Motion.reducedFadeSpec(), label = "hidden")
val summary = BackgroundWorkSummary.summary(rowAgents, rowShells)
- val surfaceColor = MaterialTheme.colorScheme.surfaceContainerHigh
+ val surfaceColor = OpenCodeSurfaces.color
val shape = remember { BackgroundWorkShape(BackgroundWorkMotion.panelRadius) }
val nestedScroll = remember(isScrollable) {
@@ -826,9 +828,10 @@ fun BackgroundWorkPresentation(
val dy = if (stage == BackgroundWorkStage.closed && progress.value == 0f && composedTop != null && now != null) now.y - composedTop else 0f
if (dy == 0f) drawContent() else translate(top = dy) { this@drawWithContent.drawContent() }
}
- .shadow(if (isPanel) 6.dp else 2.dp, shape, clip = false)
+ .shadow(if (isPanel) OpenCodeSurfaces.popoverShadow else OpenCodeSurfaces.raisedShadow, shape, clip = false)
.clip(shape)
.background(surfaceColor)
+ .openCodeHairline(shape)
.then(if (hidden) Modifier.clearAndSetSemantics { } else Modifier),
) {
// The capsule's label, a button while the surface is at rest. Kept composed under the open
diff --git a/feature/session/src/main/kotlin/ai/opencode/feature/session/ComposerViews.kt b/feature/session/src/main/kotlin/ai/opencode/feature/session/ComposerViews.kt
index 3e7a50c13..6052cbcab 100644
--- a/feature/session/src/main/kotlin/ai/opencode/feature/session/ComposerViews.kt
+++ b/feature/session/src/main/kotlin/ai/opencode/feature/session/ComposerViews.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.session
+import ai.opencode.core.ui.openCodeHairline
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.motion.Motion
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.motion.motionBlurReveal
@@ -70,6 +72,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.lerp
import androidx.compose.ui.input.pointer.PointerEventPass
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.HorizontalAlignmentLine
@@ -117,7 +120,8 @@ enum class ComposerTextStyle(val rawValue: String) {
*/
object ComposerTunables {
const val barHeight = 56f
- const val cornerRadius = 28f
+ /** The desktop dock's 12 (iOS's capsule is 28). */
+ const val cornerRadius = 12f
val textStyle = ComposerTextStyle.body
const val horizontalMargin = 20f
@@ -138,8 +142,6 @@ object ComposerTunables {
const val pillGap = 10f
/** New Plus Menu: the attachment tiles sit this far from the surface's top and leading edges (f0670c5d). */
const val attachmentInset = 19f
- /** New Plus Menu's Send while the composer is empty (iOS `emptySendOpacity`). */
- const val emptySendOpacity = 0.3f
/** New Plus Menu's Send crossfade between empty and ready, in seconds (iOS `sendFade`). */
const val sendFade = 0.15
/** New Plus Menu: the attachment row's height change as the location card arrives or leaves. */
@@ -163,6 +165,8 @@ object ComposerTunables {
const val queuedGlyphDrop = 1f
const val plusScale = 17f
const val buttonDiameter = 34f
+ /** Send's visible face, bigger than the other trailing controls (X feedback); its target stays 48. */
+ const val sendDiameter = 40f
const val trailingGap = 11f
const val micScale = 17f
const val trailingSpacing = 4f
@@ -600,17 +604,20 @@ fun ComposerControlLabel(
glyphSize: Dp = 18.dp,
visualOffsetX: Float = 0f,
glyphRise: Float = 0f,
+ faceDiameter: Float = ComposerTunables.buttonDiameter,
) {
val reduceMotion = rememberReduceMotion()
val fontScale = LocalDensity.current.fontScale
- val diameter = min(34f * fontScale * (ComposerTunables.buttonDiameter / 34f), 44f)
+ // Grows with the font scale up to 44 (Send's bigger face up to 46), inside its 48 dp target.
+ val diameter = min(fontScale * faceDiameter, max(44f, faceDiameter + 6f))
// Body grows 28/17 by Accessibility 1, where the glyph stops.
val textScale = min(fontScale, 28f / 17f)
Box(
modifier
.offset(x = visualOffsetX.dp)
.size(diameter.dp)
- .background(background, OpenCodeShape.circle),
+ // The desktop's submit button: a rounded square, not a circle.
+ .background(background, RoundedCornerShape(8.dp)),
contentAlignment = Alignment.Center,
) {
if (showsProgress) {
@@ -666,12 +673,13 @@ fun ComposerPillLabel(
modifier = Modifier
.then(if (accessibilityLabel != null) Modifier.clearAndSetSemantics {} else Modifier)
.padding(vertical = 5.dp)
- .clip(OpenCodeShape.capsule)
+ .clip(OpenCodeShape.control)
.indication(interactions, ripple()),
- shape = OpenCodeShape.capsule,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
- tonalElevation = 2.dp,
- shadowElevation = 2.dp,
+ // The desktop's floating chip: flat fill, hairline ring, a small raised shadow.
+ shape = OpenCodeShape.control,
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
) {
ComposerPillContent(title = title, rolls = rolls, leading = leading)
}
@@ -777,9 +785,11 @@ fun JumpToLatestPill(
Box(
Modifier
.size(34.dp)
- .shadow(2.dp, OpenCodeShape.circle)
- .clip(OpenCodeShape.circle)
- .background(MaterialTheme.colorScheme.surfaceContainerHigh)
+ // The desktop's floating icon button: rounded square, hairline ring.
+ .shadow(OpenCodeSurfaces.raisedShadow, OpenCodeShape.control)
+ .clip(OpenCodeShape.control)
+ .background(OpenCodeSurfaces.color)
+ .openCodeHairline(OpenCodeShape.control)
.indication(interactions, ripple()),
contentAlignment = Alignment.Center,
) {
@@ -811,15 +821,15 @@ fun ComposerBanner(
iconTint: Color = OpenCodeTheme.colors.secondaryText,
detail: String? = null,
) {
- // The pressed radius must fit even the minimum-height banner.
- val radius = OpenCodeShapeGeometry.radius(28f, 52f)
+ // The composer's (desktop dock's) radius, clamped to fit even the minimum-height banner.
+ val radius = OpenCodeShapeGeometry.radius(ComposerTunables.cornerRadius, 52f)
Surface(
onClick = onClick,
modifier = modifier.fillMaxWidth().heightIn(min = 52.dp),
shape = RoundedCornerShape(radius.dp),
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
- tonalElevation = 2.dp,
- shadowElevation = 2.dp,
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
) {
Row(
Modifier.padding(horizontal = 18.dp, vertical = 8.dp),
@@ -874,26 +884,27 @@ fun Modifier.horizontalScrollEdgeFade(state: LazyListState, width: Dp = 20.dp, i
}
/**
- * iOS `ComposerSendLabel`: New Plus Menu's one fixed Send. The enabled disc and arrow are composited
- * before dimming, so the arrow stays its colour as the empty button fades to [ComposerTunables.emptySendOpacity].
+ * iOS `ComposerSendLabel`: New Plus Menu's one fixed Send. Empty, it's a neutral face
+ * ([OpenCodeSurfaces.neutralFill]) with a secondary arrow, so it stays legible on the white
+ * composer, and fades to the send colours as text arrives (iOS dims the disc to 0.3 instead).
*/
@Composable
fun ComposerSendLabel(enabled: Boolean, showsProgress: Boolean, visualOffsetX: Float, modifier: Modifier = Modifier) {
val reduceMotion = rememberReduceMotion()
- val alpha by animateFloatAsState(
- if (enabled) 1f else ComposerTunables.emptySendOpacity,
+ val progress by animateFloatAsState(
+ if (enabled) 1f else 0f,
if (reduceMotion) snap() else tween((ComposerTunables.sendFade * 1000).toInt(), easing = FastOutSlowInEasing),
- label = "sendLabelAlpha",
+ label = "sendLabelProgress",
)
+ val colors = OpenCodeTheme.colors
ComposerControlLabel(
systemImage = "arrow.up",
showsProgress = showsProgress,
- foreground = OpenCodeTheme.colors.sendButtonForeground,
- background = OpenCodeTheme.colors.sendButtonBackground,
+ foreground = lerp(colors.secondaryText, colors.sendButtonForeground, progress),
+ background = lerp(OpenCodeSurfaces.neutralFill, colors.sendButtonBackground, progress),
visualOffsetX = visualOffsetX,
- modifier = modifier.graphicsLayer {
- this.alpha = alpha
- compositingStrategy = CompositingStrategy.ModulateAlpha
- },
+ faceDiameter = ComposerTunables.sendDiameter,
+ glyphSize = 20.dp,
+ modifier = modifier,
)
}
diff --git a/feature/session/src/main/kotlin/ai/opencode/feature/session/DraftProjects.kt b/feature/session/src/main/kotlin/ai/opencode/feature/session/DraftProjects.kt
index da52a2ee3..6fd9441b9 100644
--- a/feature/session/src/main/kotlin/ai/opencode/feature/session/DraftProjects.kt
+++ b/feature/session/src/main/kotlin/ai/opencode/feature/session/DraftProjects.kt
@@ -1,5 +1,9 @@
package ai.opencode.feature.session
+import ai.opencode.core.ui.OpenCodeSearchField
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
+import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.motion.transitionBlur
import ai.opencode.core.motion.Motion
@@ -49,8 +53,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
-import androidx.compose.material3.TextField
-import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -242,7 +244,7 @@ fun DraftProjectList(
Box(
Modifier
.alpha(highlightAlpha)
- .background(OpenCodeTheme.colors.text.copy(alpha = 0.06f), RoundedCornerShape(50)),
+ .background(OpenCodeTheme.colors.text.copy(alpha = 0.06f), RoundedCornerShape(8.dp)),
)
},
) {
@@ -308,7 +310,7 @@ private fun DraftProjectRow(
Modifier
.fillMaxWidth()
.heightIn(min = 48.dp)
- .background(OpenCodeTheme.colors.text.copy(alpha = 0.06f * highlight), RoundedCornerShape(50))
+ .background(OpenCodeTheme.colors.text.copy(alpha = 0.06f * highlight), RoundedCornerShape(8.dp))
// A hidden row has no pointer node at all: a disabled one would still be hit and end
// the search, eating taps meant for the chosen row folded under it.
.then(if (takesTouches) Modifier.clickable(role = Role.Button, onClickLabel = hint, onClick = onClick) else Modifier)
@@ -441,7 +443,12 @@ fun ProjectPickerSheet(
// ignores detents and presents the sheet at full height; half of it there showed only the
// title, the search and a row under the gesture bar (QA F-36).
val compactHeight = with(LocalDensity.current) { LocalWindowInfo.current.containerSize.height.toDp() } < 480.dp
- ModalBottomSheet(onDismissRequest = onCancel, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = compactHeight)) {
+ ModalBottomSheet(
+ onDismissRequest = onCancel,
+ sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = compactHeight),
+ dragHandle = { OpenCodeSheetHandle() },
+ shape = OpenCodeSheetDefaults.shape,
+ ) {
val routes = folderBrowser?.let { browser -> browser.collectState().value.routes }.orEmpty()
BackHandler(enabled = routes.isNotEmpty()) {
folderBrowser?.send(FolderBrowserFeature.Action.RoutesChanged(routes.dropLast(1)))
@@ -689,18 +696,10 @@ private fun SheetTitleBar(
@Composable
private fun SearchField(value: String, onValueChange: (String) -> Unit) {
- TextField(
+ OpenCodeSearchField(
value = value,
onValueChange = onValueChange,
- placeholder = { Text("Search") },
- leadingIcon = { OpenCodeIcon(SFSymbol.Magnifyingglass, contentDescription = null, size = 20.dp) },
- singleLine = true,
- shape = RoundedCornerShape(50),
- colors = TextFieldDefaults.colors(
- focusedIndicatorColor = Color.Transparent,
- unfocusedIndicatorColor = Color.Transparent,
- disabledIndicatorColor = Color.Transparent,
- ),
+ placeholder = "Search",
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp),
)
}
@@ -722,6 +721,6 @@ private fun Unavailable(symbol: SFSymbol, title: String, description: String? =
OpenCodeIcon(symbol, contentDescription = null, size = 48.dp, tint = OpenCodeTheme.colors.secondaryText)
Text(title, style = OpenCodeTextStyles.title3.copy(fontWeight = FontWeight.Bold), color = OpenCodeTheme.colors.text, textAlign = TextAlign.Center)
if (description != null) Text(description, style = OpenCodeTextStyles.callout, color = OpenCodeTheme.colors.secondaryText, textAlign = TextAlign.Center)
- if (action != null) Button(onClick = action.second) { Text(action.first) }
+ if (action != null) Button(onClick = action.second, shape = OpenCodeShape.control) { Text(action.first) }
}
}
diff --git a/feature/session/src/main/kotlin/ai/opencode/feature/session/ServerConnectionPill.kt b/feature/session/src/main/kotlin/ai/opencode/feature/session/ServerConnectionPill.kt
index e8e753fc7..adc64dc61 100644
--- a/feature/session/src/main/kotlin/ai/opencode/feature/session/ServerConnectionPill.kt
+++ b/feature/session/src/main/kotlin/ai/opencode/feature/session/ServerConnectionPill.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.session
+import ai.opencode.core.ui.OpenCodeShape
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeTextStyles
@@ -30,7 +32,6 @@ import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
@@ -182,13 +183,14 @@ fun ServerConnectionPill(
var menuShown by remember { mutableStateOf(false) }
val fontScale = LocalDensity.current.fontScale
Box(modifier) {
+ // The desktop's floating chip: flat fill, hairline ring, small radius.
Surface(
- shape = CircleShape,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
- tonalElevation = 2.dp,
- shadowElevation = 2.dp,
+ shape = OpenCodeShape.control,
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
+ shadowElevation = OpenCodeSurfaces.raisedShadow,
modifier = Modifier
- .clip(CircleShape)
+ .clip(OpenCodeShape.control)
.combinedClickable(
onClick = { onAction(notice.primary) },
onLongClick = if (offersEdit) ({ menuShown = true }) else null,
diff --git a/feature/session/src/main/kotlin/ai/opencode/feature/session/SessionSheetView.kt b/feature/session/src/main/kotlin/ai/opencode/feature/session/SessionSheetView.kt
index d30b1d8b1..f1be7e66f 100644
--- a/feature/session/src/main/kotlin/ai/opencode/feature/session/SessionSheetView.kt
+++ b/feature/session/src/main/kotlin/ai/opencode/feature/session/SessionSheetView.kt
@@ -1,5 +1,10 @@
package ai.opencode.feature.session
+import ai.opencode.core.ui.OpenCodeTextField
+import ai.opencode.core.ui.OpenCodeSheetHandle
+import ai.opencode.core.ui.OpenCodeSwitch
+import ai.opencode.core.ui.openCodeHairline
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.motion.rememberReduceMotion
@@ -52,15 +57,13 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
-import androidx.compose.material3.AlertDialog
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.LocalContentColor
-import androidx.compose.material3.OutlinedTextField
-import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.rememberModalBottomSheetState
@@ -75,7 +78,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.text.TextAutoSize
import androidx.compose.foundation.text.modifiers.TextAutoSizeLayoutScope
-import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.withFrameNanos
import androidx.compose.ui.layout.layout
@@ -355,7 +357,7 @@ fun SessionSheetPrewarm(
AlwaysNotifyCard(isOn = false, isPending = false) { }
DeleteRow(enabled = true) { }
rememberModalBottomSheetState(skipPartiallyExpanded = true)
- BottomSheetDefaults.DragHandle()
+ OpenCodeSheetHandle()
}
}
}
@@ -691,11 +693,12 @@ private fun cardFill(): Color {
}
}
-private val cardShape = RoundedCornerShape(20.dp)
+/** The desktop card: small radius, a hairline ring around its quiet fill. */
+private val cardShape = RoundedCornerShape(OpenCodeRadius.card)
@Composable
private fun DetailsCard(details: SessionSheetDetails, onModelTapped: () -> Unit, providerIcon: (@Composable (String, String?, Dp) -> Unit)?) {
- Column(Modifier.fillMaxWidth().background(cardFill(), cardShape)) {
+ Column(Modifier.fillMaxWidth().background(cardFill(), cardShape).openCodeHairline(cardShape)) {
ModelRow(details, onModelTapped, providerIcon)
HorizontalDivider(Modifier.padding(start = 16.dp))
ContextRow(details)
@@ -816,13 +819,14 @@ private fun AlwaysNotifyCard(isOn: Boolean, isPending: Boolean, onToggle: (Boole
.heightIn(min = 48.dp)
.testTag("session-sheet-always-notify")
.background(cardFill(), cardShape)
+ .openCodeHairline(cardShape)
.clip(cardShape)
.toggleable(value = isOn, enabled = !isPending, role = Role.Switch, onValueChange = onToggle)
.padding(horizontal = 16.dp, vertical = if (isAccessibilitySize) 10.dp else 0.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text("Always Notify", style = OpenCodeTextStyles.callout, color = OpenCodeTheme.colors.text, modifier = Modifier.weight(1f))
- Switch(checked = isOn, onCheckedChange = null, enabled = !isPending)
+ OpenCodeSwitch(checked = isOn, onCheckedChange = null, enabled = !isPending)
}
Text(
"Notify this $device whenever a reply finishes, even ones you didn’t send from here.",
@@ -903,14 +907,14 @@ fun SessionActionPresentations(sheet: StoreOf
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { sheet.send(SessionSheetFeature.Action.FailureDismissed) },
title = { Text(failure.title) },
text = { Text(failure.message) },
@@ -936,7 +940,7 @@ fun SessionActionPresentations(sheet: StoreOf) {
val error by store.observe { it.locationError }
val message = error ?: return
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { store.send(Action.locationErrorDismissed) },
title = { Text("Couldn’t Share Location") },
text = { Text(message) },
diff --git a/feature/session/src/main/kotlin/ai/opencode/feature/session/SessionViewAttachments.kt b/feature/session/src/main/kotlin/ai/opencode/feature/session/SessionViewAttachments.kt
index c4f541e55..2bc339b89 100644
--- a/feature/session/src/main/kotlin/ai/opencode/feature/session/SessionViewAttachments.kt
+++ b/feature/session/src/main/kotlin/ai/opencode/feature/session/SessionViewAttachments.kt
@@ -67,7 +67,7 @@ import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.AlertDialog
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
@@ -407,7 +407,7 @@ fun rememberSessionAttachmentImporter(store: StoreOf Unit, send:
Spacer(Modifier.width(48.dp))
Text(
state.shell.title,
- style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.SemiBold, fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.SemiBold, fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.text,
maxLines = 1,
overflow = TextOverflow.MiddleEllipsis,
@@ -412,7 +413,7 @@ private fun ShellOutputTextView(text: String, startCursor: Int, isFollowing: Boo
else listState.animateScrollToItem(lines.size - 1, Int.MAX_VALUE / 2)
}
}
- val style = OpenCodeTextStyles.footnote.copy(fontFamily = FontFamily.Monospace, fontSize = 13.sp, color = OpenCodeTheme.colors.text)
+ val style = OpenCodeTextStyles.footnote.copy(fontFamily = OpenCodeFonts.monospace, fontSize = 13.sp, color = OpenCodeTheme.colors.text)
SelectionContainer {
LazyColumn(
state = listState,
@@ -481,6 +482,7 @@ private fun StatusBar(state: ShellOutputFeature.State, runningGlyph: @Composable
disabledContentColor = red.copy(alpha = 0.5f),
),
modifier = Modifier.heightIn(min = 48.dp).testTag("shell-output-stop"),
+ shape = OpenCodeShape.control,
) {
if (state.isStopping) CircularProgressIndicator(Modifier.size(16.dp), strokeWidth = 2.dp)
else Text("Stop Shell")
diff --git a/feature/session/src/main/kotlin/ai/opencode/feature/session/header/SessionHeaderBackdrop.kt b/feature/session/src/main/kotlin/ai/opencode/feature/session/header/SessionHeaderBackdrop.kt
index 0cbdd9972..4d10926e6 100644
--- a/feature/session/src/main/kotlin/ai/opencode/feature/session/header/SessionHeaderBackdrop.kt
+++ b/feature/session/src/main/kotlin/ai/opencode/feature/session/header/SessionHeaderBackdrop.kt
@@ -34,7 +34,7 @@ import kotlin.math.max
* - iOS's progressive blur ([SessionHeaderStyle.Resolved.AppBlur], and the iOS 27 system edge,
* which Android resolves to the same app path) is the M3 top app bar's scrolled state: once
* content scrolls under the header, the bar from the top of the screen to the bottom of the
- * header row fills with `surfaceContainer`, with a hard bottom edge and no soft tail (a fading
+ * header row fills with the canvas over a hairline (the desktop title bar), with no soft tail (a fading
* tail left text showing through it). The fill fades in and out on the theme's effects spring,
* as `TopAppBar`'s container colour does.
* - The wash ([SessionHeaderStyle.Appearance]) is the canvas colour at its opacity through the same
@@ -66,7 +66,9 @@ fun SessionHeaderBackdrop(
if (backdrop == null && appBlur == null) return
val scheme = MaterialTheme.colorScheme
val canvas = OpenCodeTheme.colors.canvas
- val scrim = scheme.surfaceContainer
+ // The desktop's title bar: the pane's own canvas over a hairline, not a tonal fill.
+ val scrim = canvas
+ val hairline = OpenCodeTheme.colors.border
val material = when (backdrop?.blur) {
SessionHeaderStyle.Blur.UltraThin -> scheme.surfaceContainerLow
SessionHeaderStyle.Blur.Thin -> scheme.surfaceContainer
@@ -100,6 +102,8 @@ fun SessionHeaderBackdrop(
val barAlpha = if (barAnimates) bar.value else barTarget()
if (barAlpha > 0) {
drawRect(color = scrim, size = Size(size.width, barHeight.dp.toPx()), alpha = barAlpha)
+ val px = 1.dp.toPx()
+ drawRect(color = hairline, topLeft = androidx.compose.ui.geometry.Offset(0f, barHeight.dp.toPx() - px), size = Size(size.width, px), alpha = barAlpha)
}
if (backdrop != null) {
val revealed = backdrop.revealed(scrolledUnderHeader()).toFloat()
diff --git a/feature/session/src/test/kotlin/ai/opencode/feature/session/BackgroundWorkTests.kt b/feature/session/src/test/kotlin/ai/opencode/feature/session/BackgroundWorkTests.kt
index a873578cd..4afef3eb3 100644
--- a/feature/session/src/test/kotlin/ai/opencode/feature/session/BackgroundWorkTests.kt
+++ b/feature/session/src/test/kotlin/ai/opencode/feature/session/BackgroundWorkTests.kt
@@ -143,9 +143,10 @@ private val missing = OpenCodeClientError(message = "Missing", statusCode = 404)
*/
class BackgroundWorkTests {
@Test fun glassRadiusFitsCapsuleAndPanelThroughoutMorph() {
- // The 44 pt target contains 34 pt of glass: its end caps are 17, not 28.
+ // The 44 pt target contains 34 pt of surface. Android diverges from iOS on purpose: the
+ // desktop's 12 dp corners fit it whole (iOS's 28 clamps to 17 end caps).
val capsuleHeight = 44f - 2 * BackgroundWorkMotion.capsuleInset
- assertEquals(17f, OpenCodeShapeGeometry.radius(BackgroundWorkMotion.panelRadius, capsuleHeight))
+ assertEquals(12f, OpenCodeShapeGeometry.radius(BackgroundWorkMotion.panelRadius, capsuleHeight))
assertEquals(BackgroundWorkMotion.panelRadius, OpenCodeShapeGeometry.radius(BackgroundWorkMotion.panelRadius, 160f))
var height = 0f
while (height <= 320f) {
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/AppearanceSettingsView.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/AppearanceSettingsView.kt
index 5ed805859..d9d3aeb6d 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/AppearanceSettingsView.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/AppearanceSettingsView.kt
@@ -1,12 +1,13 @@
package ai.opencode.feature.settings
+import ai.opencode.core.ui.OpenCodeTopBar
+import ai.opencode.core.ui.OpenCodeTopBarBackButton
import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.sharing.shared
import ai.opencode.core.ui.AppTheme
import ai.opencode.core.ui.AppearanceColorScheme
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeRadius
-import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.core.ui.SFSymbol
import ai.opencode.core.ui.ThemeDefinition
@@ -35,16 +36,13 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
-import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SegmentedButton
import androidx.compose.material3.SegmentedButtonDefaults
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
-import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
@@ -63,7 +61,7 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.Dp
@@ -172,14 +170,11 @@ fun ThemesSettingsView(store: SettingsStore) {
Scaffold(
containerColor = colors.groupedCanvas,
topBar = {
- CenterAlignedTopAppBar(
- title = { Text("Themes", style = OpenCodeTextStyles.headline, modifier = Modifier.semantics { heading() }) },
- navigationIcon = {
- IconButton(onClick = { store.send(SettingsFeature.Action.BackTapped) }) {
- OpenCodeIcon(SFSymbol.ChevronBackward, contentDescription = "Back")
- }
- },
- colors = TopAppBarDefaults.topAppBarColors(containerColor = canvas),
+ OpenCodeTopBar(
+ title = { Text("Themes", modifier = Modifier.semantics { heading() }) },
+ navigation = { OpenCodeTopBarBackButton(onClick = { store.send(SettingsFeature.Action.BackTapped) }) },
+ centerTitle = true,
+ containerColor = canvas,
)
},
) { padding ->
@@ -420,7 +415,7 @@ private const val PreviewMaxFontScale = 19f / 17f
@Composable
private fun ImitationTranscriptPreview(theme: AppTheme, isDark: Boolean) {
val v = rememberThemeDefinition(theme).variant(isDark)
- val mono = FontFamily.Monospace
+ val mono = OpenCodeFonts.monospace
Column(
Modifier
.fillMaxWidth()
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/ModelVisibilitySettings.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/ModelVisibilitySettings.kt
index 78c66298e..1aac7fdb4 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/ModelVisibilitySettings.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/ModelVisibilitySettings.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.settings
+import ai.opencode.core.ui.OpenCodeSearchField
import ai.opencode.core.dependencies.Dependency
import ai.opencode.core.haptics.Haptic
import ai.opencode.core.haptics.HapticsClient
@@ -33,7 +34,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.CircularProgressIndicator
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.SegmentedButton
import androidx.compose.material3.SegmentedButtonDefaults
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
@@ -49,7 +49,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
@@ -246,7 +246,7 @@ fun ModelVisibilitySettingsView(store: SettingsStore) {
) {
stale.all.forEach { id ->
SettingsRowFrame {
- Text(id, style = OpenCodeTextStyles.subheadline.copy(fontFamily = FontFamily.Monospace), color = OpenCodeTheme.colors.secondaryText)
+ Text(id, style = OpenCodeTextStyles.subheadline.copy(fontFamily = OpenCodeFonts.monospace), color = OpenCodeTheme.colors.secondaryText)
}
SettingsDivider()
}
@@ -302,12 +302,10 @@ fun ModelVisibilityProviderView(store: SettingsStore, providerID: String) {
SettingsPageScaffold(title = providerTitle, store = store) {
item(key = "search") {
- OutlinedTextField(
+ OpenCodeSearchField(
value = filter,
onValueChange = { filter = it },
- placeholder = { Text("Search Models") },
- singleLine = true,
- leadingIcon = { OpenCodeIcon(SFSymbol.Magnifyingglass, contentDescription = null, size = 20.dp) },
+ placeholder = "Search Models",
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 4.dp),
)
}
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/SettingsRows.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/SettingsRows.kt
index d5b2b7b11..782d83165 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/SettingsRows.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/SettingsRows.kt
@@ -1,5 +1,10 @@
package ai.opencode.feature.settings
+import ai.opencode.core.ui.OpenCodeSwitch
+import ai.opencode.core.ui.OpenCodeTextStyles
+import androidx.compose.ui.text.font.FontWeight
+import ai.opencode.core.ui.OpenCodeTypography
+import androidx.compose.foundation.BorderStroke
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.ui.OpenCodeTheme
@@ -27,8 +32,6 @@ import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
-import androidx.compose.material3.Switch
-import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.Typography
import androidx.compose.runtime.Composable
@@ -39,10 +42,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.drawWithCache
-import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.graphics.Path
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.semantics.Role
@@ -54,7 +54,6 @@ import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
-import androidx.compose.ui.zIndex
/**
* Port of iOS `Settings/SettingsRows.swift` plus the inset-grouped `List`/`Section` chrome every
@@ -67,15 +66,18 @@ import androidx.compose.ui.zIndex
* chevron, section headers are in the accent colour, and text uses Material's list sizes.
*/
-/** Material's list type scale (16 sp titles, 14 sp summaries); the app's own styles are iOS sizes. */
+/** Settings' type: the app's desktop-derived scale (this branch), not Material's default Roboto list sizes. */
object SettingsText {
- private val material = Typography()
- val title: TextStyle = material.bodyLarge
- val summary: TextStyle = material.bodyMedium
- val header: TextStyle = material.titleSmall
-
- /** Material's whole default scale, for the Settings top app bar's large title. */
- val typography: Typography = material
+ /** Desktop list item: medium weight (`list.css` 530) at phone size. */
+ val title: TextStyle = OpenCodeTextStyles.callout.copy(fontWeight = FontWeight.Medium)
+ val summary: TextStyle = OpenCodeTextStyles.footnote
+ val header: TextStyle = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.Medium)
+
+ /** The app's (Inter) scale, with a larger headline for the Settings top app bar's large title. */
+ val typography: Typography = OpenCodeTypography.copy(
+ headlineMedium = OpenCodeTextStyles.title1,
+ headlineLarge = OpenCodeTextStyles.largeTitle,
+ )
}
/** iOS system tints for [SettingsIcon] tiles (`Color.purple`, `.blue`, …), light and dark. */
@@ -173,9 +175,11 @@ fun SettingsSection(
modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 8.dp).semantics { heading() },
)
}
+ // The desktop's card: flat fill inside a hairline border, small radius.
Surface(
color = OpenCodeTheme.colors.groupedCard,
shape = RoundedCornerShape(OpenCodeRadius.card),
+ border = BorderStroke(1.dp, OpenCodeTheme.colors.border),
modifier = Modifier.fillMaxWidth(),
) {
Column(content = rows)
@@ -191,61 +195,14 @@ fun SettingsSection(
}
/**
- * What parts two rows on a section card. iOS draws an inset hairline; Android leaves a 2 dp gap
- * of the page canvas and rounds the rows' inner corners by 4 dp, as Material 3 Expressive
- * segmented lists do. [inset] is kept so the call sites stay as on iOS, but every gap spans the
- * card. The gap draws over its neighbours (`zIndex`), so a row's ripple or highlight never
- * covers the rounded corners.
+ * What parts two rows on a section card: on this branch the desktop list's inset hairline (as
+ * iOS draws), replacing Material 3 Expressive's 2 dp segmented gap. [inset] is kept so the call
+ * sites stay as on iOS.
*/
@Composable
fun SettingsDivider(inset: Boolean = false) {
- val canvas = OpenCodeTheme.colors.groupedCanvas
- Spacer(
- Modifier
- .fillMaxWidth()
- .height(SegmentGap)
- .zIndex(1f)
- .drawWithCache {
- val corners = segmentCorners(size.width, size.height, SegmentInnerRadius.toPx())
- onDrawBehind {
- drawRect(canvas)
- drawPath(corners, canvas)
- }
- },
- )
-}
-
-private val SegmentGap = 2.dp
-private val SegmentInnerRadius = 4.dp
-
-/**
- * The canvas-coloured corners a gap of height [gap] fills in to round the rows beside it: the
- * row above's bottom corners and the row below's top corners. Each is the [radius] square in the
- * card's corner minus the quarter circle the rounded row keeps.
- */
-private fun segmentCorners(width: Float, gap: Float, radius: Float): Path {
- val path = Path()
- // Above the gap, start edge.
- path.moveTo(0f, 0f)
- path.lineTo(radius, 0f)
- path.arcTo(Rect(0f, -2 * radius, 2 * radius, 0f), 90f, 90f, false)
- path.close()
- // Above the gap, end edge.
- path.moveTo(width, 0f)
- path.lineTo(width - radius, 0f)
- path.arcTo(Rect(width - 2 * radius, -2 * radius, width, 0f), 90f, -90f, false)
- path.close()
- // Below the gap, start edge.
- path.moveTo(0f, gap)
- path.lineTo(radius, gap)
- path.arcTo(Rect(0f, gap, 2 * radius, gap + 2 * radius), 270f, -90f, false)
- path.close()
- // Below the gap, end edge.
- path.moveTo(width, gap)
- path.lineTo(width - radius, gap)
- path.arcTo(Rect(width - 2 * radius, gap, width, gap + 2 * radius), 270f, 90f, false)
- path.close()
- return path
+ // The desktop list's divider: a hairline inset 16 (`list.css`), not Material's segmented gap.
+ HorizontalDivider(Modifier.padding(start = 16.dp), thickness = 1.dp, color = OpenCodeTheme.colors.border)
}
/** A row's frame: full-width target, 16 dp sides, at least [SettingsRowMinHeight] tall, 16 dp between its parts. */
@@ -276,7 +233,8 @@ fun SettingsRowFrame(
*/
@Composable
fun SettingsRowText(title: String, summary: String?, modifier: Modifier = Modifier) {
- Column(modifier) {
+ // Inter's tight line height sets the summary right against the title without a small gap.
+ Column(modifier, verticalArrangement = Arrangement.spacedBy(2.dp)) {
Text(title, style = SettingsText.title, color = OpenCodeTheme.colors.text)
if (summary != null) {
Text(
@@ -345,16 +303,7 @@ fun SettingsToggleRow(
) {
if (symbol != null) SettingsIcon(symbol, tint)
SettingsRowText(title, summary, Modifier.weight(1f))
- Switch(
- checked = checked,
- onCheckedChange = null,
- enabled = enabled,
- thumbContent = if (checked) {
- { OpenCodeIcon(SFSymbol.Checkmark, contentDescription = null, size = SwitchDefaults.IconSize) }
- } else {
- null
- },
- )
+ OpenCodeSwitch(checked = checked, onCheckedChange = null, enabled = enabled)
}
}
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/SettingsView.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/SettingsView.kt
index 33bd21758..6e9e9fb75 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/SettingsView.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/SettingsView.kt
@@ -11,10 +11,11 @@ import ai.opencode.core.store.PresentationAction
import ai.opencode.core.store.StoreOf
import ai.opencode.core.store.observe
import ai.opencode.core.store.scope
-import ai.opencode.core.ui.OpenCodeIcon
+import ai.opencode.core.ui.OpenCodeLargeTopBar
import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
-import ai.opencode.core.ui.SFSymbol
+import ai.opencode.core.ui.OpenCodeTopBar
+import ai.opencode.core.ui.OpenCodeTopBarBackButton
import ai.opencode.core.ui.ThemeSharedKeys
import ai.opencode.core.ui.AccessibilityFocusRequest
import ai.opencode.core.ui.accessibilityFocusRequest
@@ -43,13 +44,9 @@ import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material3.ExperimentalMaterial3Api
-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
-import androidx.compose.material3.IconButton
-import androidx.compose.material3.LargeFlexibleTopAppBar
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
-import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -185,13 +182,13 @@ private fun OnboardingPlaygroundPresentation(store: SettingsStore) {
* One Settings page's chrome (iOS `List` + inline `navigationTitle` + Back): a Back control
* (“Back” closes Settings at the root, pops otherwise) and a list of grouped rows.
*
- * Android divergence: the bar is Material 3 Expressive's large flexible top app bar, whose
- * start-aligned title collapses into the bar as the list scrolls, and the page sets text in
+ * Android divergence: the bar is the desktop title bar ([OpenCodeLargeTopBar]): a start-aligned
+ * large title that scrolls up into the bar as the list scrolls, and the page sets text in
* Material's own type scale ([SettingsText.typography]) rather than iOS's 17 pt body. A page
* that draws its own title ([titleVisible] false, as What's New's entry page does) keeps the
* small bar, its title fading in over 0.15 s once the page's title scrolls under it.
*/
-@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
+@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SettingsPageScaffold(
title: String,
@@ -207,16 +204,13 @@ fun SettingsPageScaffold(
content: LazyListScope.() -> Unit,
) {
val canvas = OpenCodeTheme.colors.groupedCanvas
- val barColors = TopAppBarDefaults.topAppBarColors(containerColor = canvas, scrolledContainerColor = canvas)
val scrollBehavior = if (drawsOwnTitle) {
TopAppBarDefaults.pinnedScrollBehavior()
} else {
TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
}
val back: @Composable () -> Unit = {
- IconButton(onClick = { store.send(SettingsFeature.Action.BackTapped) }) {
- OpenCodeIcon(SFSymbol.ChevronBackward, contentDescription = "Back")
- }
+ OpenCodeTopBarBackButton(onClick = { store.send(SettingsFeature.Action.BackTapped) })
}
MaterialTheme(
colorScheme = MaterialTheme.colorScheme,
@@ -229,28 +223,30 @@ fun SettingsPageScaffold(
containerColor = canvas,
topBar = {
if (drawsOwnTitle) {
- TopAppBar(
+ OpenCodeTopBar(
title = {
val alpha by animateFloatAsState(if (titleVisible) 1f else 0f, tween(150, easing = Motion.EaseOut), label = "settings-title")
Text(
title,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
modifier = Modifier
.graphicsLayer { this.alpha = alpha }
.then(if (titleVisible) Modifier.semantics { heading() } else Modifier.clearAndSetSemantics {}),
)
},
- navigationIcon = back,
+ navigation = back,
actions = actions,
scrollBehavior = scrollBehavior,
- colors = barColors,
+ containerColor = canvas,
)
} else {
- LargeFlexibleTopAppBar(
- title = { Text(title, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.semantics { heading() }) },
- navigationIcon = back,
- actions = actions,
+ OpenCodeLargeTopBar(
+ title = title,
scrollBehavior = scrollBehavior,
- colors = barColors,
+ navigation = back,
+ actions = actions,
+ containerColor = canvas,
)
}
},
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceDelegatorSettings.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceDelegatorSettings.kt
index 21e85240c..5e6a7419f 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceDelegatorSettings.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceDelegatorSettings.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.settings
+import ai.opencode.core.ui.OpenCodeSearchField
import ai.opencode.core.experiments.ExperimentalFeature
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeTextStyles
@@ -18,7 +19,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import ai.opencode.core.store.observe
import androidx.compose.runtime.Composable
@@ -181,13 +181,11 @@ internal fun VoiceDelegatorSettingsPage(store: SettingsStore) {
val server = state.connectedServer
if (server != null) {
item(key = "search") {
- OutlinedTextField(
+ OpenCodeSearchField(
value = searchQuery,
onValueChange = { searchQuery = it },
+ placeholder = "Filter sessions",
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 4.dp),
- placeholder = { Text("Filter sessions") },
- leadingIcon = { OpenCodeIcon(SFSymbol.Magnifyingglass, contentDescription = null, size = 18.dp) },
- singleLine = true,
)
}
settingsSection(
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceKeyEditor.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceKeyEditor.kt
index 4ad5604e6..8d60f8c7e 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceKeyEditor.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceKeyEditor.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.settings
+import ai.opencode.core.ui.OpenCodeTextField
+import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.diagnostics.HidesFromScreenshots
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeTextStyles
@@ -17,7 +19,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material3.FilledTonalButton
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
@@ -25,7 +26,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
@@ -44,7 +45,7 @@ internal fun VoiceKeyEditor(state: VoiceSettingsFeature.State, voice: VoiceStore
HidesFromScreenshots()
Column(Modifier.padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
val keyInput = @Composable { fieldModifier: Modifier ->
- OutlinedTextField(
+ OpenCodeTextField(
value = key,
onValueChange = { value ->
voice.send(VoiceSettingsFeature.Action.ApiKeyEdited(value))
@@ -54,11 +55,11 @@ internal fun VoiceKeyEditor(state: VoiceSettingsFeature.State, voice: VoiceStore
VoiceProvider.xAI -> settings(HomeSettingsFeature.Action.XaiAPIKeyChanged(saved))
}
},
- placeholder = { Text(provider.keyPlaceholder) },
+ placeholder = provider.keyPlaceholder,
singleLine = true,
visualTransformation = if (state.revealsKey) VisualTransformation.None else PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password, autoCorrectEnabled = false),
- textStyle = if (state.revealsKey) OpenCodeTextStyles.subheadline.copy(fontFamily = FontFamily.Monospace) else SettingsText.title,
+ textStyle = if (state.revealsKey) OpenCodeTextStyles.subheadline.copy(fontFamily = OpenCodeFonts.monospace) else SettingsText.title,
trailingIcon = {
Box(
Modifier
@@ -77,6 +78,7 @@ internal fun VoiceKeyEditor(state: VoiceSettingsFeature.State, voice: VoiceStore
FilledTonalButton(
onClick = { voice.send(VoiceSettingsFeature.Action.VerifyKeyTapped) },
enabled = state.activeAPIKey.isNotEmpty() && !state.isCheckingKey,
+ shape = OpenCodeShape.control,
) { Text("Verify") }
}
if (stacked) {
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceProviderPage.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceProviderPage.kt
index 1d120f047..cc502089c 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceProviderPage.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/VoiceProviderPage.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.settings
+import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.diagnostics.HidesFromScreenshots
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeTextStyles
@@ -155,6 +156,7 @@ internal fun VoiceProviderDetailPage(store: SettingsStore, opensAccount: Boolean
.heightIn(min = 48.dp)
.semantics { contentDescription = "Use ${other.name}" },
contentPadding = PaddingValues(horizontal = 14.dp),
+ shape = OpenCodeShape.control,
) { Text("Use", style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.SemiBold)) }
}
}
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/connection/ConnectionCard.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/connection/ConnectionCard.kt
index e6d092ccc..de50c12fe 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/connection/ConnectionCard.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/connection/ConnectionCard.kt
@@ -1,5 +1,8 @@
package ai.opencode.feature.settings.connection
+import ai.opencode.core.ui.OpenCodeRadius
+import ai.opencode.core.ui.OpenCodeTextField
+import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.motion.Motion
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.motion.rememberReduceMotion
@@ -61,9 +64,8 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.selection.SelectionContainer
-import androidx.compose.material3.AlertDialog
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.ripple
@@ -90,7 +92,7 @@ import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.stateDescription
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.style.TextOverflow
@@ -106,9 +108,12 @@ import kotlin.math.roundToInt
/** iOS `HomeFeature.State.credentialsRejectedStatus`: the HTTP status a refused sign-in comes back with. */
const val credentialsRejectedStatus = 401
-/** The card's geometry (iOS `ConnectionCard.cornerRadius`, `boxInset`, `textInset`). */
+/**
+ * The card's geometry (iOS `ConnectionCard.cornerRadius`, `boxInset`, `textInset`). On this branch
+ * the card takes the Settings groups' desktop card radius, so it reads as one of them.
+ */
private object ConnectionCardMetrics {
- val cornerRadius = 26.dp
+ val cornerRadius = OpenCodeRadius.card
/** The scope box's inset from the card. */
val boxInset = 6.dp
/** The text column's inset from the box. */
@@ -221,6 +226,7 @@ private fun ConnectionCardContent(
.fillMaxWidth()
.clip(cardShape)
.background(colors.groupedCard)
+ .border(1.dp, colors.border, cardShape)
.clickable(interactionSource = interaction, indication = ripple(), role = Role.Button, onClick = onOpen)
// Ahead of the clearing below, which would drop its marker.
.accessibilityFocusRequest(focusRequest)
@@ -340,7 +346,7 @@ private fun CardText(
@Composable
private fun CardAddress(monitor: ConnectionMonitor, stacked: Boolean) {
val color = OpenCodeTheme.colors.tertiaryText
- val mono = OpenCodeTextStyles.caption1.copy(fontFamily = FontFamily.Monospace)
+ val mono = OpenCodeTextStyles.caption1.copy(fontFamily = OpenCodeFonts.monospace)
val caption = OpenCodeTextStyles.caption1
if (stacked) {
Column(Modifier.padding(top = 1.dp), verticalArrangement = Arrangement.spacedBy(2.dp)) {
@@ -585,7 +591,7 @@ private fun RetryLabel(
) {
Box(
modifier
- .clip(RoundedCornerShape(50))
+ .clip(OpenCodeShape.control)
.background(OpenCodeTheme.colors.text.copy(alpha = 0.11f))
.indication(interaction, ripple())
.height(30.dp)
@@ -642,7 +648,7 @@ fun ServerPage(store: SettingsStore) {
SelectionContainer {
Text(
monitor.server.host,
- style = SettingsText.title.copy(fontFamily = FontFamily.Monospace),
+ style = SettingsText.title.copy(fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.secondaryText,
maxLines = 1,
overflow = TextOverflow.MiddleEllipsis,
@@ -696,16 +702,16 @@ fun ServerPage(store: SettingsStore) {
}
if (renaming) {
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { renaming = false },
title = { Text("Rename Server") },
text = {
Column {
Text("Only this ${ai.opencode.core.ui.ThisDevice.name} uses the name. Leave it blank for “${current.friendlyName}”.")
- OutlinedTextField(
+ OpenCodeTextField(
value = nameDraft,
onValueChange = { nameDraft = it },
- placeholder = { Text(current.friendlyName) },
+ placeholder = current.friendlyName,
singleLine = true,
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Words),
modifier = Modifier.fillMaxWidth().padding(top = 12.dp),
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/connection/SettingsServers.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/connection/SettingsServers.kt
index 261702a02..c3a238fdf 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/connection/SettingsServers.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/connection/SettingsServers.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.settings.connection
+import ai.opencode.core.ui.OpenCodeTextField
import ai.opencode.core.sharing.shared
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeTheme
@@ -24,12 +25,11 @@ import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.KeyboardOptions
-import androidx.compose.material3.AlertDialog
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
@@ -121,16 +121,16 @@ fun SettingsServersSection(
}
renaming?.let { server ->
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { renaming = null },
title = { Text("Rename Server") },
text = {
Column {
Text("Only this ${ai.opencode.core.ui.ThisDevice.name} uses the name. Leave it blank to use the computer’s.")
- OutlinedTextField(
+ OpenCodeTextField(
value = nameDraft,
onValueChange = { nameDraft = it },
- placeholder = { Text(server.friendlyName) },
+ placeholder = server.friendlyName,
singleLine = true,
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Words),
modifier = Modifier.fillMaxWidth().padding(top = 12.dp),
@@ -148,7 +148,7 @@ fun SettingsServersSection(
}
removing?.let { server ->
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { removing = null },
title = { Text("Remove ${server.friendlyName}?") },
text = { Text("This forgets the address and password on this ${ai.opencode.core.ui.ThisDevice.name}. Sessions on the server are not affected.") },
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/OnboardingPlaygroundControls.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/OnboardingPlaygroundControls.kt
index 82ffb6194..10128f766 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/OnboardingPlaygroundControls.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/OnboardingPlaygroundControls.kt
@@ -1,5 +1,6 @@
package ai.opencode.feature.settings.onboarding
+import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.store.StoreOf
import ai.opencode.core.store.observe
@@ -112,7 +113,7 @@ internal fun OnboardingPlaygroundControls(
}
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- FilledTonalButton(onClick = { store.send(Action.ReplayTapped) }) {
+ FilledTonalButton(onClick = { store.send(Action.ReplayTapped) }, shape = OpenCodeShape.control) {
OpenCodeIcon(SFSymbol.ArrowCounterclockwise, contentDescription = null, size = OpenCodeIconSize.small)
Spacer(Modifier.size(6.dp))
Text("Replay")
@@ -140,6 +141,7 @@ private fun FailureMenu(failure: Failure?, onChange: (Failure?) -> Unit) {
contentDescription = "Server"
stateDescription = title
},
+ shape = OpenCodeShape.control,
) {
OpenCodeIcon(
if (failure == null) SFSymbol.CheckmarkCircle else SFSymbol.ExclamationmarkTriangle,
@@ -182,6 +184,7 @@ private fun PhaseButton(control: Control, current: Boolean, onClick: () -> Unit)
onClick = onClick,
modifier = Modifier.heightIn(min = 48.dp).semantics { selected = current },
contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp),
+ shape = OpenCodeShape.control,
) {
Box(
Modifier
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/OnboardingPlaygroundView.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/OnboardingPlaygroundView.kt
index 1e5b732f1..0e7e26f98 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/OnboardingPlaygroundView.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/OnboardingPlaygroundView.kt
@@ -1,5 +1,9 @@
package ai.opencode.feature.settings.onboarding
+import ai.opencode.core.ui.openCodeHairline
+import ai.opencode.core.ui.OpenCodeSurfaces
+import ai.opencode.core.ui.OpenCodeRadius
+import ai.opencode.core.ui.OpenCodeShape
import ai.opencode.core.motion.transitionBlurEffect
import ai.opencode.core.diagnostics.HidesFromScreenshots
@@ -193,6 +197,7 @@ fun OnboardingPlaygroundView(
FilledTonalButton(
onClick = { store.send(Action.ControlsHiddenChanged(false)) },
modifier = Modifier.heightIn(min = 48.dp).widthIn(min = 64.dp),
+ shape = OpenCodeShape.control,
) {
OpenCodeIcon(SFSymbol.ChevronUp, contentDescription = "Show Controls", size = OpenCodeIconSize.small)
}
@@ -427,9 +432,10 @@ private fun Camera(on: Boolean, send: (Action) -> Unit) {
Entrance(on, 2) {
Text(
"opencode pair --remote",
- style = OpenCodeTextStyles.callout.copy(fontFamily = OpenCodeFonts.berkeleyMono, fontSize = 15.sp),
+ style = OpenCodeTextStyles.callout.copy(fontFamily = OpenCodeFonts.monospace, fontSize = 15.sp),
modifier = Modifier
- .background(MaterialTheme.colorScheme.surfaceContainerHighest, RoundedCornerShape(8.dp))
+ .background(OpenCodeSurfaces.neutralFill, OpenCodeShape.control)
+ .openCodeHairline(OpenCodeShape.control)
.padding(horizontal = 10.dp, vertical = 6.dp),
)
}
@@ -479,7 +485,7 @@ private fun Connected(on: Boolean, send: (Action) -> Unit) {
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) {
Entrance(on, 0) {
Box(
- Modifier.size(56.dp).background(MaterialTheme.colorScheme.surfaceContainerHighest, CircleShape),
+ Modifier.size(56.dp).background(OpenCodeSurfaces.neutralFill, CircleShape).openCodeHairline(CircleShape),
contentAlignment = Alignment.Center,
) {
OpenCodeIcon(SFSymbol.Checkmark, contentDescription = null, size = OpenCodeIconSize.large)
@@ -685,7 +691,7 @@ private fun ApertureLayer(
val shownTarget = phase == Phase.camera || phase == Phase.waiting
val shown = animateFloatAsState(if (shownTarget) 1f else 0f, OnboardingMotion.layout(reduceMotion), label = "aperture")
val waiting = animateFloatAsState(if (phase == Phase.waiting) 1f else 0f, OnboardingMotion.layout(reduceMotion), label = "found")
- val shape = RoundedCornerShape(32.dp)
+ val shape = RoundedCornerShape(OpenCodeRadius.panel)
val density = LocalDensity.current.density
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.TopCenter) {
Box(
@@ -796,14 +802,15 @@ private fun FirstSessionPage(
Modifier
.fillMaxWidth()
.heightIn(min = 52.dp)
- .background(MaterialTheme.colorScheme.surfaceContainerHigh, RoundedCornerShape(26.dp))
+ .background(OpenCodeSurfaces.color, RoundedCornerShape(OpenCodeRadius.panel))
+ .openCodeHairline(RoundedCornerShape(OpenCodeRadius.panel))
.padding(start = 18.dp, end = 8.dp)
.semantics(mergeDescendants = true) { contentDescription = "Message" },
verticalAlignment = Alignment.CenterVertically,
) {
Text("Ask anything…", color = secondary(), modifier = Modifier.weight(1f))
Box(
- Modifier.size(36.dp).background(OpenCodeTheme.colors.tertiaryText, CircleShape),
+ Modifier.size(36.dp).background(OpenCodeTheme.colors.tertiaryText, OpenCodeShape.control),
contentAlignment = Alignment.Center,
) {
OpenCodeIcon(SFSymbol.ArrowUp, contentDescription = null, size = OpenCodeIconSize.small, tint = OpenCodeTheme.colors.canvas)
@@ -840,6 +847,7 @@ private fun PrimaryButton(title: String, active: Boolean, onClick: () -> Unit) {
disabledContentColor = content,
),
contentPadding = OpenCodeButtonDefaults.contentPadding,
+ shape = OpenCodeShape.control,
) { Text(title, style = OpenCodeTextStyles.headline) }
}
@@ -852,19 +860,25 @@ private fun SecondaryButton(title: String, active: Boolean, onClick: () -> Unit)
modifier = Modifier.fillMaxWidth().heightIn(min = OpenCodeButtonDefaults.height),
colors = colors.copy(disabledContainerColor = colors.containerColor, disabledContentColor = colors.contentColor),
contentPadding = OpenCodeButtonDefaults.contentPadding,
+ shape = OpenCodeShape.control,
) { Text(title, style = OpenCodeTextStyles.headline) }
}
-/** iOS's large circular glass icon button; off (without dimming) while its page is inactive. */
+/**
+ * iOS's large circular glass icon button, drawn as the desktop's icon button (a rounded square
+ * with a hairline, like `OpenCodeIconButton(style = Circle)`); off (without dimming) while its
+ * page is inactive.
+ */
@Composable
private fun CircleIconButton(symbol: SFSymbol, label: String, active: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier) {
- val container = MaterialTheme.colorScheme.surfaceContainerHighest
+ val container = OpenCodeSurfaces.neutralFill
val content = OpenCodeTheme.colors.text
+ val shape = RoundedCornerShape(OpenCodeRadius.card)
FilledTonalIconButton(
onClick = onClick,
enabled = active,
- modifier = modifier.size(48.dp),
- shape = CircleShape,
+ modifier = modifier.size(48.dp).openCodeHairline(shape),
+ shape = shape,
colors = IconButtonDefaults.filledTonalIconButtonColors(
containerColor = container,
contentColor = content,
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeBrowser.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeBrowser.kt
index 83c58d812..4a4dfde1c 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeBrowser.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeBrowser.kt
@@ -47,7 +47,7 @@ private fun mono(size: Float, weight: FontWeight = FontWeight.Normal) =
* The OpenCode website (`opencode.ai`) in dark mode, as the laptop's browser shows it on
* `localhost:3000` (iOS `WelcomeSitePage`): warm dark canvas, architectural grid rails, the pixel
* wordmark, monospace hero, install command, and the platform CTA that [grow] expands from a
- * modest desktop chip (0) into a full-width “Download for iPhone” button (1).
+ * modest desktop chip (0) into a full-width “Download for Android” button (1).
*/
@Composable
internal fun WelcomeSitePage(modifier: Modifier = Modifier, grow: Double = 1.0, sheen: Double = 0.0) {
@@ -162,7 +162,7 @@ private fun CtaButton(grow: Double, sheen: Double) {
}
Row(Modifier.fillMaxWidth().padding(horizontal = 10.dp).alpha(afterIn), horizontalArrangement = Arrangement.spacedBy(6.dp), verticalAlignment = Alignment.CenterVertically) {
OpenCodeIcon("platter.filled.top.iphone", null, size = 10.5.dp, tint = WelcomeSitePage.canvas)
- Text("Download for iPhone", fontSize = 10.5.sp, fontWeight = FontWeight.SemiBold, color = WelcomeSitePage.canvas, maxLines = 1, softWrap = false)
+ Text("Download for Android", fontSize = 10.5.sp, fontWeight = FontWeight.SemiBold, color = WelcomeSitePage.canvas, maxLines = 1, softWrap = false)
Spacer(Modifier.weight(1f))
Text(
"couch-ready →",
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeDesktop.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeDesktop.kt
index 2ec00b920..13172d92a 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeDesktop.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeDesktop.kt
@@ -32,6 +32,7 @@ import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.TransformOrigin
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.text.TextStyle
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
@@ -190,14 +191,14 @@ private fun DesktopColumn(frame: WelcomeFrame, wall: Double, reduced: Boolean, t
Text(WelcomeScreenshot.NAME, style = ui(13f), color = deskDim)
}
Text(
- WelcomeStreamedText.attributed(WelcomeStory.REPLY_WORDS, frame.deskWords, deskText, code = FontFamily.Monospace),
+ WelcomeStreamedText.attributed(WelcomeStory.REPLY_WORDS, frame.deskWords, deskText, code = OpenCodeFonts.monospace),
style = ui(13f).copy(lineHeight = 19.sp),
modifier = Modifier.fillMaxWidth().padding(top = 10.dp, bottom = 4.dp).welcomeRow(frame.deskReply),
)
Bubble(WelcomeStory.SHIP_IT, WelcomeTarget.DeskShip, targets, Modifier.padding(top = 14.dp).welcomeShow(frame.deskShip, dy = 6f, scale = 0.95f, anchor = trailing, reduced = reduced).welcomeRow(frame.deskShip))
ToolRow("terminal", Modifier.padding(top = 10.dp).welcomeShow(frame.run, dy = 4f, reduced = reduced).welcomeRow(frame.run)) {
Text("Running commands", style = ui(13f), color = deskText, modifier = Modifier.welcomeShimmer(1.0, wall, reduced))
- Text("git push", style = ui(12.5f, family = FontFamily.Monospace), color = deskDim)
+ Text("git push", style = ui(12.5f, family = OpenCodeFonts.monospace), color = deskDim)
}
}
}
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomePhone.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomePhone.kt
index 35c24c962..fd897ab44 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomePhone.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomePhone.kt
@@ -51,12 +51,14 @@ import kotlin.math.min
private fun body(weight: FontWeight = FontWeight.Normal) = TextStyle(fontSize = 17.sp, lineHeight = 22.sp, fontWeight = weight)
-private val phoneText = Color.White
+private val phoneText = WelcomeInk.hex(0xEDEDED)
private val phoneSecondary = WelcomeInk.label2
private val phoneTertiary = WelcomeInk.label3
-/** The app's dark tonal surfaces standing in for iOS glass. */
-private val phoneSurface = WelcomeInk.hex(0x232326)
-private val phoneSurfaceHigh = WelcomeInk.hex(0x2C2C30)
+/** The app's dark canvas, composer surface, bubble fill and hairline (the desktop palette, as the session draws them). */
+private val phoneCanvas = WelcomeInk.hex(0x161616)
+private val phoneSurface = WelcomeInk.hex(0x1C1C1C)
+private val phoneSurfaceHigh = WelcomeInk.hex(0x2E2E2E)
+private val phoneHairline = WelcomeInk.hex(0x2D2D2D)
/**
* The phone's screen: this app's session in dark mode, at a logical 440 × 956 scaled into the
@@ -66,7 +68,7 @@ private val phoneSurfaceHigh = WelcomeInk.hex(0x2C2C30)
*/
@Composable
internal fun WelcomePhone(frame: WelcomeFrame, pairing: Float, reduced: Boolean, voice: WelcomeVoice, wall: Double, targets: WelcomeTargets?) {
- Box(Modifier.requiredSize(WelcomePhone.size.width.dp, WelcomePhone.size.height.dp).background(Color.Black)) {
+ Box(Modifier.requiredSize(WelcomePhone.size.width.dp, WelcomePhone.size.height.dp).background(phoneCanvas)) {
Box(Modifier.fillMaxSize().alpha(1 - pairing).welcomeBlur(if (reduced) 0f else 3f * pairing)) {
Box(Modifier.fillMaxSize().alpha(frame.transcript.toFloat()).welcomeBlur(if (reduced || frame.loopBlur < 0.05) 0f else frame.loopBlur.toFloat())) {
PhoneTranscript(frame, reduced, wall, targets)
@@ -87,15 +89,15 @@ internal fun WelcomePhone(frame: WelcomeFrame, pairing: Float, reduced: Boolean,
PhoneStatusBar()
Box(
Modifier
- .offset(x = ((WelcomePhone.size.width - 140) / 2).dp, y = (WelcomePhone.size.height - 13).dp)
- .size(140.dp, 5.dp)
- .background(Color.White.copy(alpha = 0.85f), CircleShape),
+ .offset(x = ((WelcomePhone.size.width - 108) / 2).dp, y = (WelcomePhone.size.height - 12).dp)
+ .size(108.dp, 4.dp)
+ .background(Color.White.copy(alpha = 0.8f), CircleShape),
)
}
}
internal object WelcomePhone {
- /** The phone's logical screen (iPhone 17 Pro Max). */
+ /** The phone's logical screen (iOS draws an iPhone 17 Pro Max at the same size). */
val size = Size(440f, 956f)
/** The composer's bottom edge, above the home indicator. */
@@ -110,10 +112,10 @@ internal object WelcomePhone {
const val GUTTER = 16f
const val FLOW_HALF = 8f
- /** The screenshot tile's corners (iOS `JustifiedImageRows.cornerRadius`). */
- const val TILE_RADIUS = 14f
+ /** The screenshot tile's corners: the desktop card's 10 (iOS `JustifiedImageRows.cornerRadius` 14). */
+ const val TILE_RADIUS = 10f
- /** The session header's circles (iOS `HeaderBlurTunables.buttonSize`). */
+ /** The session header's buttons (iOS `HeaderBlurTunables.buttonSize`). */
const val BUTTON = 44f
/** The composer's metrics (iOS `ComposerTunables`, `DictationBarPose.slot`). */
@@ -122,7 +124,8 @@ internal object WelcomePhone {
const val INNER_VERTICAL = 6f
const val TEXT_LEADING = 52f
const val EXPANDED_TEXT_LEADING = 10f
- const val CORNER = 26f
+ /** The composer's corners: the desktop dock's 12 (iOS 26). */
+ const val CORNER = 12f
const val SLOT = 48f
/** The agent's calls so far: reads, the browser, the edit, the screenshot (iOS `tools`). */
@@ -135,73 +138,82 @@ internal object WelcomePhone {
}
}
+/**
+ * An Android status bar (iOS draws the iPhone's: centred time, Dynamic Island): the time on the
+ * left, a centred punch-hole camera, and Wi-Fi, signal and battery on the right.
+ */
@Composable
private fun PhoneStatusBar() {
- Box(Modifier.fillMaxWidth()) {
- Text("9:41", style = TextStyle(fontSize = 16.5.sp, fontWeight = FontWeight.SemiBold), color = Color.White, modifier = Modifier.offset(y = 19.dp).width(146.dp), textAlign = androidx.compose.ui.text.style.TextAlign.Center)
+ Box(Modifier.fillMaxWidth().height(44.dp)) {
+ Text(
+ "9:30",
+ style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Medium),
+ color = Color.White,
+ modifier = Modifier.align(Alignment.CenterStart).padding(start = 28.dp),
+ )
Box(
Modifier
- .offset(x = ((WelcomePhone.size.width - 120) / 2).dp, y = 12.dp)
- .size(120.dp, 34.dp)
+ .align(Alignment.Center)
+ .size(22.dp)
.background(Color.Black, CircleShape)
- .border(0.5.dp, Color.White.copy(alpha = 0.08f), CircleShape),
+ .border(0.75.dp, Color.White.copy(alpha = 0.1f), CircleShape),
)
Row(
- Modifier.offset(y = 20.dp).width((WelcomePhone.size.width - 30).dp),
- horizontalArrangement = Arrangement.spacedBy(6.dp, Alignment.End),
+ Modifier.align(Alignment.CenterEnd).padding(end = 26.dp),
+ horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
- // Signal bars and a full battery, drawn (no Material Symbol matches the system glyphs).
- Canvas(Modifier.size(18.dp, 12.dp)) {
- val bar = size.width / 5.5f
- for (index in 0 until 4) {
- val h = size.height * (0.4f + 0.2f * index)
- drawRoundRect(Color.White, Offset(index * bar * 1.5f, size.height - h), Size(bar, h), androidx.compose.ui.geometry.CornerRadius(bar / 3))
- }
+ OpenCodeIcon("wifi", null, size = 16.dp, tint = Color.White)
+ // Cellular signal as Android draws it: a filled right triangle.
+ Canvas(Modifier.size(14.dp, 14.dp)) {
+ val triangle = Path()
+ triangle.moveTo(size.width, 0f)
+ triangle.lineTo(size.width, size.height)
+ triangle.lineTo(0f, size.height)
+ triangle.close()
+ drawPath(triangle, Color.White)
}
- OpenCodeIcon("wifi", null, size = 17.dp, tint = Color.White)
- Canvas(Modifier.size(27.dp, 13.dp)) {
- val body = Size(size.width - 2.5.dp.toPx(), size.height)
- drawRoundRect(Color.White.copy(alpha = 0.4f), Offset.Zero, body, androidx.compose.ui.geometry.CornerRadius(4.dp.toPx()), style = Stroke(1.dp.toPx()))
- val inset = 2.dp.toPx()
- drawRoundRect(Color.White, Offset(inset, inset), Size(body.width - 2 * inset, body.height - 2 * inset), androidx.compose.ui.geometry.CornerRadius(2.5.dp.toPx()))
- drawRoundRect(Color.White.copy(alpha = 0.4f), Offset(body.width + 1.dp.toPx(), size.height * 0.33f), Size(1.5.dp.toPx(), size.height * 0.34f), androidx.compose.ui.geometry.CornerRadius(1.dp.toPx()))
+ // A full battery: a rounded body with a small cap on the right.
+ Canvas(Modifier.size(24.dp, 12.dp)) {
+ val cap = 2.dp.toPx()
+ val body = Size(size.width - cap - 1.dp.toPx(), size.height)
+ drawRoundRect(Color.White, Offset.Zero, body, androidx.compose.ui.geometry.CornerRadius(3.5.dp.toPx()))
+ drawRoundRect(
+ Color.White.copy(alpha = 0.6f),
+ Offset(body.width + 1.dp.toPx(), size.height * 0.3f),
+ Size(cap, size.height * 0.4f),
+ androidx.compose.ui.geometry.CornerRadius(1.dp.toPx()),
+ )
}
}
}
}
-/** The session header's parts: the drawer and More circles and the title capsule (iOS `header`; Material surfaces for glass). */
+/**
+ * The session header as this app draws it on the desktop palette (iOS `header` has glass circles
+ * and a title capsule): the drawer and More icons on the canvas, the title and project beside them.
+ */
@Composable
private fun PhoneHeader(frame: WelcomeFrame) {
val size = WelcomePhone.BUTTON
- Box(Modifier.offset(y = WelcomePhone.HEADER_TOP.dp).fillMaxWidth().height(size.dp), contentAlignment = Alignment.Center) {
- Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp), verticalAlignment = Alignment.CenterVertically) {
- Box(Modifier.size(size.dp).background(phoneSurface, CircleShape), contentAlignment = Alignment.Center) {
- OpenCodeIcon("line.3.horizontal", null, size = 20.dp, tint = phoneText)
- }
- Spacer(Modifier.weight(1f))
- Box(Modifier.size(size.dp).background(phoneSurface, CircleShape), contentAlignment = Alignment.Center) {
- OpenCodeIcon("ellipsis", null, size = 20.dp, tint = phoneText)
- }
+ Row(
+ Modifier.offset(y = WelcomePhone.HEADER_TOP.dp).fillMaxWidth().height(size.dp).padding(horizontal = 8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Box(Modifier.size(size.dp), contentAlignment = Alignment.Center) {
+ OpenCodeIcon("line.3.horizontal", null, size = 22.dp, tint = phoneText)
}
- Column(
- Modifier
- .heightIn(min = size.dp)
- .widthIn(max = 260.dp)
- .background(phoneSurface, CircleShape)
- .padding(horizontal = 18.dp, vertical = 3.dp),
- horizontalAlignment = Alignment.CenterHorizontally,
- verticalArrangement = Arrangement.Center,
- ) {
+ Column(Modifier.weight(1f).padding(start = 8.dp), verticalArrangement = Arrangement.Center) {
WelcomeStack(
labels = listOf("New Session", WelcomeStory.TITLE),
weights = if (frame.named) listOf(0.0, 1.0) else listOf(1.0, 0.0),
- style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.SemiBold),
+ style = TextStyle(fontSize = 17.sp, lineHeight = 21.sp, fontWeight = FontWeight.Medium),
color = phoneText,
- alignment = Alignment.Center,
)
- Text(WelcomeStory.PROJECT, style = TextStyle(fontSize = 12.sp), color = phoneText.copy(alpha = 0.75f), maxLines = 1)
+ Text(WelcomeStory.PROJECT, style = TextStyle(fontSize = 13.sp, lineHeight = 16.sp), color = phoneSecondary, maxLines = 1)
+ }
+ Box(Modifier.size(size.dp), contentAlignment = Alignment.Center) {
+ OpenCodeIcon("ellipsis", null, size = 20.dp, tint = phoneText)
}
}
}
@@ -268,7 +280,7 @@ private fun UserBubble(text: String, modifier: Modifier) {
color = phoneText,
modifier = Modifier
.widthIn(max = 320.dp)
- .background(phoneSurfaceHigh, RoundedCornerShape(20.dp))
+ .background(phoneSurfaceHigh, RoundedCornerShape(10.dp))
.padding(horizontal = 14.dp, vertical = 9.dp),
)
}
@@ -325,6 +337,7 @@ private fun PhoneComposer(frame: WelcomeFrame, reduced: Boolean, voice: WelcomeV
Modifier
.width(width.dp)
.background(phoneSurface, RoundedCornerShape(WelcomePhone.CORNER.dp))
+ .border(1.dp, phoneHairline, RoundedCornerShape(WelcomePhone.CORNER.dp))
.padding(horizontal = WelcomePhone.INNER.dp, vertical = WelcomePhone.INNER_VERTICAL.dp),
) {
Box(Modifier.fillMaxWidth().height(line.dp).alpha((frame.draft * frame.lines).toFloat()).clip(androidx.compose.ui.graphics.RectangleShape), contentAlignment = Alignment.BottomStart) {
@@ -343,7 +356,7 @@ private fun PhoneComposer(frame: WelcomeFrame, reduced: Boolean, voice: WelcomeV
Box(
Modifier
.size(34.dp)
- .background(Color.White.copy(alpha = 0.12f * dictation), CircleShape)
+ .background(Color.White.copy(alpha = 0.12f * dictation), RoundedCornerShape(8.dp))
.graphicsLayer { rotationZ = 45 * dictation },
contentAlignment = Alignment.Center,
) { OpenCodeIcon("plus", null, size = 22.dp, tint = phoneText) }
@@ -369,7 +382,7 @@ private fun PhoneComposer(frame: WelcomeFrame, reduced: Boolean, voice: WelcomeV
},
contentAlignment = Alignment.Center,
) {
- Box(Modifier.requiredSize(34.dp).background(Color.White, CircleShape), contentAlignment = Alignment.Center) {
+ Box(Modifier.requiredSize(34.dp).background(Color.White, RoundedCornerShape(8.dp)), contentAlignment = Alignment.Center) {
Box(Modifier.size(11.dp).background(Color.Black, RoundedCornerShape(2.dp)))
}
}
@@ -435,12 +448,12 @@ private fun PhoneScanner(modifier: Modifier) {
drawContent()
},
) {
- Box(Modifier.offset(16.dp, WelcomePhone.HEADER_TOP.dp).size(WelcomePhone.BUTTON.dp).background(phoneSurface, CircleShape), contentAlignment = Alignment.Center) {
+ Box(Modifier.offset(16.dp, WelcomePhone.HEADER_TOP.dp).size(WelcomePhone.BUTTON.dp).background(phoneSurface, RoundedCornerShape(10.dp)).border(1.dp, phoneHairline, RoundedCornerShape(10.dp)), contentAlignment = Alignment.Center) {
OpenCodeIcon("xmark", null, size = 18.dp, tint = phoneText)
}
Box(Modifier.offset(90.dp, 330.dp).size(260.dp), contentAlignment = Alignment.Center) {
Canvas(Modifier.fillMaxSize()) {
- drawPath(WelcomeViewfinderCorners.path(Rect(Offset.Zero, size), 24.dp.toPx()), Color.White, style = Stroke(4.dp.toPx(), cap = StrokeCap.Round))
+ drawPath(WelcomeViewfinderCorners.path(Rect(Offset.Zero, size), 12.dp.toPx()), Color.White, style = Stroke(2.5.dp.toPx(), cap = StrokeCap.Round))
}
Box(
Modifier
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeScene.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeScene.kt
index ca39372db..27dd55bc3 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeScene.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeScene.kt
@@ -93,7 +93,7 @@ data class WelcomeSceneLayout(
val laptopWidth = 1 + 2 * baseOverhang
val laptopHeight = lidHeight + baseHeight
val phoneHeight = laptopHeight * PHONE_RATIO
- val phoneBezelRatio = 0.026f
+ val phoneBezelRatio = 0.02f
val phoneAspect = WelcomePhone.size.height / WelcomePhone.size.width
val phoneWidth = phoneHeight / ((1 - 2 * phoneBezelRatio) * phoneAspect + 2 * phoneBezelRatio)
val unit = Size(laptopWidth + phoneWidth * (1 - OVERLAP), phoneHeight)
@@ -345,7 +345,7 @@ private fun Laptop(layout: WelcomeSceneLayout, frame: WelcomeFrame, wall: Double
private fun Phone(layout: WelcomeSceneLayout, frame: WelcomeFrame, wall: Double, pairing: Float, reduced: Boolean, voice: WelcomeVoice, targets: WelcomeTargets?, modifier: Modifier) {
val phone = layout.phone
val screen = layout.phoneScreen
- val corner = phone.width * 0.174f
+ val corner = phone.width * 0.11f
val outerShape = RoundedCornerShape(corner.dp)
val innerShape = RoundedCornerShape(max(0f, corner - (screen.left - phone.left)).dp)
Box(modifier.size(layout.size.width.dp, layout.size.height.dp)) {
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeStory.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeStory.kt
index 34a36d84d..73685831e 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeStory.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeStory.kt
@@ -50,7 +50,7 @@ val TuningContext.Companion.welcome: TuningContext get() = TuningContext("welcom
/**
* The story the scene tells, as times in story seconds (iOS `WelcomeStory`): the person dictates
* a task on the phone and sends it; OpenCode on the laptop reads the repo, opens OpenCode's own
- * dark-mode site in a browser, edits `Hero.tsx`, watches the “Download for iPhone” button spring
+ * dark-mode site in a browser, edits `Hero.tsx`, watches the “Download for Android” button spring
* open and takes a screenshot; the screenshot and reply land on the phone; the person dictates
* “Ship it” and the laptop runs `git push`. Every frame is a pure function of time, so the loop
* never accumulates state and Reduce Motion draws the proof moment.
@@ -212,10 +212,10 @@ data class WelcomeStory(
}
companion object {
- const val PROMPT = "Add an iPhone download button and show me"
+ const val PROMPT = "Add an Android download button and show me"
const val SHIP_IT = "Ship it"
- const val REPLY = "Done: added the Download for iPhone button to `Hero.tsx` on the home page."
- const val TITLE = "Download for iPhone"
+ const val REPLY = "Done: added the Download for Android button to `Hero.tsx` on the home page."
+ const val TITLE = "Download for Android"
const val PROJECT = "opencode"
val PROMPT_WORDS = words(PROMPT)
val SHIP_WORDS = words(SHIP_IT)
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeView.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeView.kt
index 1a9297059..ae748a945 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeView.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/onboarding/WelcomeView.kt
@@ -1,5 +1,12 @@
package ai.opencode.feature.settings.onboarding
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
+import androidx.compose.foundation.layout.width
+import androidx.compose.ui.draw.clip
+import ai.opencode.core.ui.openCodeHairline
+import ai.opencode.core.ui.OpenCodeSurfaces
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.store.StoreOf
@@ -62,7 +69,7 @@ import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.semantics.testTag
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
@@ -321,6 +328,8 @@ private fun WelcomeOtherWays(pasteError: String?, send: (WelcomeFeature.Action)
ModalBottomSheet(
onDismissRequest = onDismiss,
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = false),
+ dragHandle = { OpenCodeSheetHandle() },
+ shape = OpenCodeSheetDefaults.shape,
) {
Column(
Modifier
@@ -362,7 +371,7 @@ private fun OtherWaysSection(
if (header != null) {
Text(header, style = OpenCodeTextStyles.footnote, color = OpenCodeTheme.colors.secondaryText, modifier = Modifier.padding(horizontal = 16.dp).semantics { heading() })
}
- Surface(shape = RoundedCornerShape(16.dp), color = MaterialTheme.colorScheme.surfaceContainerHigh) {
+ Surface(shape = RoundedCornerShape(OpenCodeRadius.card), color = OpenCodeSurfaces.color, border = OpenCodeSurfaces.border) {
Column(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 4.dp), content = content)
}
if (footer != null) {
@@ -396,10 +405,15 @@ private fun WelcomeCommand(command: String, onCopy: (String) -> Unit) {
delay(1_500)
copied = false
}
+ // The desktop's shell block: a clearly filled box with a hairline, as on the connection screen.
+ val shape = RoundedCornerShape(OpenCodeRadius.fill)
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 48.dp)
+ .clip(shape)
+ .background(OpenCodeSurfaces.commandFill, shape)
+ .openCodeHairline(shape)
.clickable {
onCopy(command)
copied = true
@@ -412,9 +426,10 @@ private fun WelcomeCommand(command: String, onCopy: (String) -> Unit) {
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
+ Spacer(Modifier.width(4.dp))
Text(
command,
- style = OpenCodeTextStyles.callout.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.callout.copy(fontFamily = OpenCodeFonts.monospace),
modifier = Modifier.weight(1f),
)
OpenCodeIcon(
@@ -423,6 +438,7 @@ private fun WelcomeCommand(command: String, onCopy: (String) -> Unit) {
tint = OpenCodeTheme.colors.secondaryText,
size = 16.dp,
)
+ Spacer(Modifier.width(4.dp))
}
}
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/serverdetails/ServerDetailsTrays.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/serverdetails/ServerDetailsTrays.kt
index bd1219be5..700650ea9 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/serverdetails/ServerDetailsTrays.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/serverdetails/ServerDetailsTrays.kt
@@ -1,5 +1,9 @@
package ai.opencode.feature.settings.serverdetails
+import ai.opencode.core.ui.OpenCodeSearchField
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.motion.Motion
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.motion.PageTransitions
@@ -48,7 +52,6 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
@@ -65,7 +68,7 @@ import androidx.compose.ui.geometry.Size
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.semantics.semantics
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
@@ -95,6 +98,8 @@ internal fun ServerDetailsTray(
onDismissRequest = { send(ServerDetailsFeature.Action.TrayChanged(null)) },
sheetState = sheetState,
containerColor = OpenCodeTheme.colors.groupedCanvas,
+ dragHandle = { OpenCodeSheetHandle() },
+ shape = OpenCodeSheetDefaults.shape,
) {
when (tray) {
ServerDetailsFeature.Tray.Mcp -> MCPServersTray(state, send, close)
@@ -132,7 +137,7 @@ private fun TrayHeader(title: String?, subtitle: String?, onClose: () -> Unit, o
/** The inset-grouped card a tray's rows sit on. */
@Composable
private fun TrayCard(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
- Box(modifier.padding(horizontal = 16.dp).fillMaxWidth().clip(RoundedCornerShape(26.dp)).background(OpenCodeTheme.colors.groupedCard)) {
+ Box(modifier.padding(horizontal = OpenCodeRadius.card).fillMaxWidth().clip(RoundedCornerShape(OpenCodeRadius.panel)).background(OpenCodeTheme.colors.groupedCard)) {
content()
}
}
@@ -206,9 +211,9 @@ private fun MCPServersList(
LazyColumn(contentPadding = PaddingValues(top = 8.dp, bottom = 24.dp)) {
itemsIndexed(servers, key = { _, mcp -> mcp.name }) { index, mcp ->
val shape = when {
- servers.size == 1 -> RoundedCornerShape(26.dp)
- index == 0 -> RoundedCornerShape(topStart = 26.dp, topEnd = 26.dp)
- index == servers.lastIndex -> RoundedCornerShape(bottomStart = 26.dp, bottomEnd = 26.dp)
+ servers.size == 1 -> RoundedCornerShape(OpenCodeRadius.panel)
+ index == 0 -> RoundedCornerShape(topStart = OpenCodeRadius.panel, topEnd = OpenCodeRadius.panel)
+ index == servers.lastIndex -> RoundedCornerShape(bottomStart = OpenCodeRadius.panel, bottomEnd = OpenCodeRadius.panel)
else -> RoundedCornerShape(0.dp)
}
// iOS `.animation(.spring(duration: 0.3, bounce: 0), value: servers)`.
@@ -304,13 +309,13 @@ private fun MCPServerTray(
when (mcp.status) {
is OpenCodeMCPServer.Status.Failed -> mcp.errorText?.let { error ->
val red = SettingsTint.Red.color()
- val shape = RoundedCornerShape(16.dp)
+ val shape = RoundedCornerShape(OpenCodeRadius.card)
SelectionContainer(
Modifier.fillMaxWidth().background(red.copy(alpha = 0.1f), shape).border(0.5.dp, red.copy(alpha = 0.25f), shape).padding(14.dp),
) {
Text(
error,
- style = OpenCodeTextStyles.footnote.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.footnote.copy(fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.text,
)
}
@@ -329,7 +334,7 @@ private fun MCPServerTray(
Spacer(Modifier.weight(1f))
Text(
mcp.name,
- style = OpenCodeTextStyles.subheadline.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.subheadline.copy(fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.secondaryText,
)
}
@@ -431,13 +436,10 @@ private fun SkillsTray(skills: List, close: () -> Uni
}
Column(Modifier.fillMaxSize()) {
TrayHeader("Skills", "${skills.size} on this server", close)
- OutlinedTextField(
+ OpenCodeSearchField(
value = query,
onValueChange = { query = it },
- placeholder = { Text("Search Skills") },
- leadingIcon = { OpenCodeIcon(SFSymbol.Magnifyingglass, contentDescription = null) },
- singleLine = true,
- shape = CircleShape,
+ placeholder = "Search Skills",
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 4.dp),
)
if (shown.isEmpty()) {
@@ -447,9 +449,9 @@ private fun SkillsTray(skills: List, close: () -> Uni
LazyColumn(Modifier.weight(1f), contentPadding = PaddingValues(top = 8.dp, bottom = 24.dp)) {
itemsIndexed(shown, key = { _, skill -> skill.id }) { index, skill ->
val shape = when {
- shown.size == 1 -> RoundedCornerShape(26.dp)
- index == 0 -> RoundedCornerShape(topStart = 26.dp, topEnd = 26.dp)
- index == shown.lastIndex -> RoundedCornerShape(bottomStart = 26.dp, bottomEnd = 26.dp)
+ shown.size == 1 -> RoundedCornerShape(OpenCodeRadius.panel)
+ index == 0 -> RoundedCornerShape(topStart = OpenCodeRadius.panel, topEnd = OpenCodeRadius.panel)
+ index == shown.lastIndex -> RoundedCornerShape(bottomStart = OpenCodeRadius.panel, bottomEnd = OpenCodeRadius.panel)
else -> RoundedCornerShape(0.dp)
}
Column(Modifier.padding(horizontal = 16.dp).clip(shape).background(OpenCodeTheme.colors.groupedCard)) {
@@ -459,7 +461,7 @@ private fun SkillsTray(skills: List, close: () -> Uni
) {
Text(
skill.name,
- style = SettingsText.title.copy(fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium),
+ style = SettingsText.title.copy(fontFamily = OpenCodeFonts.monospace, fontWeight = FontWeight.Medium),
color = OpenCodeTheme.colors.text,
)
val description = skill.description
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/serverdetails/ServerDetailsView.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/serverdetails/ServerDetailsView.kt
index 7376df046..dacd08529 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/serverdetails/ServerDetailsView.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/serverdetails/ServerDetailsView.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.settings.serverdetails
+import ai.opencode.core.ui.OpenCodeTextField
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.diagnostics.HidesFromScreenshots
import ai.opencode.core.motion.MotionSpring
import ai.opencode.core.store.StoreOf
@@ -40,10 +42,9 @@ import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.AlertDialog
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults
@@ -74,7 +75,7 @@ import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.foundation.text.KeyboardOptions
@@ -198,16 +199,16 @@ fun ServerDetailsPage(store: SettingsStore) {
@Composable
private fun CodeAlert(instructions: String, send: (ServerDetailsFeature.Action) -> Unit) {
var code by rememberSaveable { mutableStateOf("") }
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { send(ServerDetailsFeature.Action.CodeCancelled) },
title = { Text("Paste the Code") },
text = {
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
if (instructions.isNotEmpty()) Text(instructions)
- OutlinedTextField(
+ OpenCodeTextField(
value = code,
onValueChange = { code = it },
- label = { Text("Code") },
+ label = "Code",
singleLine = true,
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None, autoCorrectEnabled = false),
)
@@ -320,7 +321,7 @@ private fun SkillsTile(skills: List, onTap: () -> Uni
skills.take(2).forEach { skill ->
Text(
skill.name,
- style = OpenCodeTextStyles.caption1.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.caption1.copy(fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.secondaryText,
maxLines = 1,
softWrap = false,
@@ -342,7 +343,7 @@ private fun OverviewTile(
content: @Composable () -> Unit,
) {
// Android divergence: a ripple answers the press (iOS shrinks the tile to 98 %).
- val shape = RoundedCornerShape(26.dp)
+ val shape = RoundedCornerShape(OpenCodeRadius.panel)
Box(
modifier
.background(OpenCodeTheme.colors.groupedCard, shape)
@@ -401,7 +402,7 @@ internal fun ProblemBanner(
val needsAuth = mcp.status is OpenCodeMCPServer.Status.NeedsAuth
val brand = ServerBrand.mcp(mcp.name)
val tone = mcp.status.tintColor()
- val shape = RoundedCornerShape(22.dp)
+ val shape = RoundedCornerShape(OpenCodeRadius.card)
Row(
modifier
.background(OpenCodeTheme.colors.groupedCard, shape)
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/servers/PairingScanner.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/servers/PairingScanner.kt
index ebdd89123..96afe7bd6 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/servers/PairingScanner.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/servers/PairingScanner.kt
@@ -3,18 +3,22 @@ package ai.opencode.feature.settings.servers
import ai.opencode.core.dependencies.PasteboardClient
import ai.opencode.core.dependencies.dependency
import ai.opencode.core.ui.AppearanceColorScheme
+import ai.opencode.core.ui.OpenCodeAlertDialog
import ai.opencode.core.ui.OpenCodeButtonDefaults
import ai.opencode.core.ui.OpenCodeFonts
import ai.opencode.core.ui.OpenCodeIcon
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.ui.OpenCodeSecondaryButton
+import ai.opencode.core.ui.OpenCodeShape
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
+import ai.opencode.core.ui.OpenCodeTopBar
import ai.opencode.core.ui.accessibilityFocusRequest
+import ai.opencode.core.ui.openCodeHairline
import ai.opencode.core.ui.rememberAccessibilityFocusRequest
import ai.opencode.core.ui.rememberAppAppearance
-import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
-import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -25,16 +29,12 @@ import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
-import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
-import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -44,7 +44,17 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.drawBehind
+import androidx.compose.ui.geometry.CornerRadius
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Rect
+import androidx.compose.ui.geometry.RoundRect
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Path
+import androidx.compose.ui.graphics.PathFillType
+import androidx.compose.ui.graphics.StrokeCap
+import androidx.compose.ui.graphics.drawscope.DrawScope
+import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
@@ -124,9 +134,13 @@ fun PairingScannerView(
OpenCodeTheme(theme = appearance.theme, appearance = AppearanceColorScheme.Dark) {
Scaffold(
modifier = modifier,
- containerColor = Color.Black,
+ containerColor = OpenCodeTheme.colors.canvas,
topBar = {
- CenterAlignedTopAppBar(
+ OpenCodeTopBar(
+ centerTitle = true,
+ hairline = false,
+ containerColor = OpenCodeTheme.colors.canvas,
+ contentColor = OpenCodeTheme.colors.text,
title = {
Text(
"Scan Pairing Code",
@@ -134,20 +148,16 @@ fun PairingScannerView(
modifier = Modifier.accessibilityFocusRequest(titleFocus).semantics { heading() },
)
},
- navigationIcon = { TextButton(onClick = onCancel) { Text("Cancel") } },
+ navigation = { ScannerBarButton("Cancel", onClick = onCancel) },
actions = {
if (isCameraAvailable && !isAccessDenied) {
- TextButton(onClick = ::paste) { Text("Paste") }
+ ScannerBarButton("Paste", onClick = ::paste)
}
},
- colors = TopAppBarDefaults.topAppBarColors(
- containerColor = Color.Black,
- titleContentColor = Color.White,
- ),
)
},
) { padding ->
- Box(Modifier.fillMaxSize().background(Color.Black)) {
+ Box(Modifier.fillMaxSize().background(OpenCodeTheme.colors.canvas)) {
when {
!isCameraAvailable -> PairingScannerFallback(
symbol = "camera.metering.unknown",
@@ -177,7 +187,7 @@ fun PairingScannerView(
}
}
if (pasteFailed) {
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { pasteFailed = false },
confirmButton = { TextButton(onClick = { pasteFailed = false }) { Text("OK") } },
title = { Text("Nothing to Paste") },
@@ -189,6 +199,18 @@ fun PairingScannerView(
}
}
+/** The bar's text controls: plain labels with the desktop's control corners for the press state. */
+@Composable
+private fun ScannerBarButton(label: String, onClick: () -> Unit) {
+ TextButton(
+ onClick = onClick,
+ shape = OpenCodeShape.control,
+ colors = ButtonDefaults.textButtonColors(contentColor = OpenCodeTheme.colors.text),
+ ) {
+ Text(label, style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.Medium))
+ }
+}
+
@Composable
private fun PairingViewfinder(modifier: Modifier = Modifier) {
Column(modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally) {
@@ -196,33 +218,78 @@ private fun PairingViewfinder(modifier: Modifier = Modifier) {
Box(
Modifier
.size(250.dp)
- .border(BorderStroke(3.dp, Color.White.copy(alpha = 0.9f)), RoundedCornerShape(28.dp))
+ .drawBehind { drawViewfinder(Color.White) }
.clearAndSetSemantics {},
)
Spacer(Modifier.weight(1f))
Column(
Modifier
.padding(start = 24.dp, end = 24.dp, bottom = 32.dp)
- .background(Color.Black.copy(alpha = 0.6f), RoundedCornerShape(18.dp))
+ .background(OpenCodeSurfaces.color.copy(alpha = 0.92f), OpenCodeShape.panel)
+ .openCodeHairline(OpenCodeShape.panel)
.padding(horizontal = 20.dp, vertical = 14.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp),
) {
- Text("Point your camera at the QR code", style = OpenCodeTextStyles.headline, color = Color.White, textAlign = TextAlign.Center)
+ Text("Point your camera at the QR code", style = OpenCodeTextStyles.headline, color = OpenCodeTheme.colors.text, textAlign = TextAlign.Center)
Text(
buildAnnotatedString {
append("Run ")
- withStyle(SpanStyle(fontFamily = OpenCodeFonts.berkeleyMono, fontSize = 15.sp)) { append("opencode pair --remote") }
+ withStyle(SpanStyle(fontFamily = OpenCodeFonts.monospace, fontSize = 14.sp, color = OpenCodeTheme.colors.text)) {
+ append("opencode pair --remote")
+ }
append(" on your computer to show it.")
},
style = OpenCodeTextStyles.subheadline,
- color = Color.White.copy(alpha = 0.8f),
+ color = OpenCodeTheme.colors.secondaryText,
textAlign = TextAlign.Center,
)
}
}
}
+/**
+ * The viewfinder: four bold corner marks around a window with the desktop's sheet radius, and the
+ * scene outside the window dimmed. The marks sit just outside the window, on the dimmed scene, so
+ * they stay legible over bright scenes.
+ */
+private fun DrawScope.drawViewfinder(color: Color) {
+ val radius = OpenCodeRadius.sheet.toPx()
+ val dim = Path().apply {
+ fillType = PathFillType.EvenOdd
+ addRect(Rect(-size.width * 8, -size.height * 8, size.width * 9, size.height * 9))
+ addRoundRect(RoundRect(Rect(Offset.Zero, size), CornerRadius(radius)))
+ }
+ drawPath(dim, Color.Black.copy(alpha = 0.4f))
+
+ val stroke = 5.dp.toPx()
+ val arm = 44.dp.toPx()
+ // The stroke's centre line runs half a stroke outside the window edge.
+ val left = -stroke / 2
+ val top = -stroke / 2
+ val right = size.width + stroke / 2
+ val bottom = size.height + stroke / 2
+ val r = radius + stroke / 2
+ val corners = Path()
+ // Top left
+ corners.moveTo(left, top + arm)
+ corners.arcTo(Rect(left, top, left + 2 * r, top + 2 * r), 180f, 90f, false)
+ corners.lineTo(left + arm, top)
+ // Top right
+ corners.moveTo(right - arm, top)
+ corners.arcTo(Rect(right - 2 * r, top, right, top + 2 * r), 270f, 90f, false)
+ corners.lineTo(right, top + arm)
+ // Bottom right
+ corners.moveTo(right, bottom - arm)
+ corners.arcTo(Rect(right - 2 * r, bottom - 2 * r, right, bottom), 0f, 90f, false)
+ corners.lineTo(right - arm, bottom)
+ // Bottom left
+ corners.moveTo(left + arm, bottom)
+ corners.arcTo(Rect(left, bottom - 2 * r, left + 2 * r, bottom), 90f, 90f, false)
+ corners.lineTo(left, bottom - arm)
+ drawPath(corners, color, style = Stroke(width = stroke, cap = StrokeCap.Round))
+}
+
@Composable
private fun PairingScannerFallback(
symbol: String,
@@ -238,12 +305,12 @@ private fun PairingScannerFallback(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically),
) {
- OpenCodeIcon(symbol, contentDescription = null, size = 34.dp, tint = Color.White.copy(alpha = 0.75f))
- Text(title, style = OpenCodeTextStyles.headline, color = Color.White, textAlign = TextAlign.Center)
+ OpenCodeIcon(symbol, contentDescription = null, size = 28.dp, tint = OpenCodeTheme.colors.secondaryText)
+ Text(title, style = OpenCodeTextStyles.headline, color = OpenCodeTheme.colors.text, textAlign = TextAlign.Center)
Text(
inlineCode(message),
style = OpenCodeTextStyles.subheadline,
- color = Color.White.copy(alpha = 0.75f),
+ color = OpenCodeTheme.colors.secondaryText,
textAlign = TextAlign.Center,
)
Column(Modifier.padding(top = 8.dp).fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(12.dp)) {
@@ -269,6 +336,7 @@ private fun PasteButton(prominent: Boolean, onClick: () -> Unit, content: @Compo
colors = ButtonDefaults.buttonColors(containerColor = Color.White, contentColor = Color.Black),
contentPadding = OpenCodeButtonDefaults.contentPadding,
content = content,
+ shape = OpenCodeShape.control,
)
} else {
OpenCodeSecondaryButton(onClick = onClick, modifier = Modifier.fillMaxWidth(), content = content)
diff --git a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/whatsnew/WhatsNewView.kt b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/whatsnew/WhatsNewView.kt
index 4a435803e..b23271a0b 100644
--- a/feature/settings/src/main/kotlin/ai/opencode/feature/settings/whatsnew/WhatsNewView.kt
+++ b/feature/settings/src/main/kotlin/ai/opencode/feature/settings/whatsnew/WhatsNewView.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.settings.whatsnew
+import ai.opencode.core.ui.OpenCodeSwitch
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.experiments.ExperimentalFeature
import ai.opencode.core.experiments.key
import ai.opencode.core.motion.rememberReduceMotion
@@ -52,7 +54,6 @@ import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
-import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -188,7 +189,7 @@ private fun WhatsNewOptionsMenu(isButtonEnabled: Boolean, onEnabledChange: (Bool
DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
DropdownMenuItem(
text = { Text("Show in Drawer") },
- trailingIcon = { Switch(checked = isButtonEnabled, onCheckedChange = null) },
+ trailingIcon = { OpenCodeSwitch(checked = isButtonEnabled, onCheckedChange = null) },
onClick = { onEnabledChange(!isButtonEnabled) },
modifier = Modifier.semantics { toggleableState = ToggleableState(isButtonEnabled) },
)
@@ -308,7 +309,7 @@ fun WhatsNewDetailPage(store: SettingsStore, entryID: String) {
.padding(top = 8.dp)
.padding(horizontal = 20.dp)
.fillMaxWidth()
- .clip(RoundedCornerShape(26.dp))
+ .clip(RoundedCornerShape(OpenCodeRadius.panel))
.background(OpenCodeTheme.colors.groupedCard)
.padding(6.dp),
) {
@@ -336,7 +337,7 @@ fun WhatsNewDetailPage(store: SettingsStore, entryID: String) {
.padding(horizontal = 20.dp)
.padding(top = 22.dp)
.fillMaxWidth()
- .clip(RoundedCornerShape(26.dp))
+ .clip(RoundedCornerShape(OpenCodeRadius.panel))
.background(OpenCodeTheme.colors.groupedCard),
) {
current.details.forEachIndexed { index, detail ->
@@ -520,7 +521,7 @@ private fun WhatsNewDotSymbol(symbol: String, tint: Color, modifier: Modifier =
}
Box(
modifier
- .clip(RoundedCornerShape(20.dp))
+ .clip(RoundedCornerShape(OpenCodeRadius.card))
.background(if (isDark) Color(0.04f, 0.04f, 0.04f) else Color(0.965f, 0.965f, 0.965f))
.onSizeChanged { size = it },
) {
diff --git a/feature/system/src/main/kotlin/ai/opencode/feature/system/intents/AskOpenCodeActivity.kt b/feature/system/src/main/kotlin/ai/opencode/feature/system/intents/AskOpenCodeActivity.kt
index a09bc444c..eb82b287c 100644
--- a/feature/system/src/main/kotlin/ai/opencode/feature/system/intents/AskOpenCodeActivity.kt
+++ b/feature/system/src/main/kotlin/ai/opencode/feature/system/intents/AskOpenCodeActivity.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.system.intents
+import ai.opencode.core.ui.OpenCodeTextField
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.feature.system.LeftToRight
import ai.opencode.feature.system.SessionDirectory
import ai.opencode.core.dependencies.AppContext
@@ -36,7 +38,6 @@ import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.SegmentedButton
import androidx.compose.material3.SegmentedButtonDefaults
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
@@ -204,12 +205,14 @@ private fun AskOpenCodeView(
Surface(
modifier = Modifier.padding(24.dp).widthIn(max = 520.dp).fillMaxWidth()
.clickable(onClick = {}, indication = null, interactionSource = null),
- shape = MaterialTheme.shapes.extraLarge,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
+ // The desktop dialog: floating fill, hairline ring, 12 dp corners, no tonal elevation.
+ shape = OpenCodeSurfaces.dialogShape,
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
// Explicit: `contentColorFor` matches roles by value, and in the dark themes the
// container shares its colour with a role whose content colour is dim.
contentColor = MaterialTheme.colorScheme.onSurface,
- tonalElevation = 6.dp,
+ tonalElevation = 0.dp,
) {
Column(Modifier.padding(24.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
@@ -232,11 +235,11 @@ private fun AskOpenCodeView(
return@Column
}
val focus = remember { FocusRequester() }
- OutlinedTextField(
+ OpenCodeTextField(
value = state.message,
onValueChange = { text -> onUpdate { it.copy(message = text) } },
- label = { Text(AskOpenCodeIntent.MESSAGE_TITLE) },
- placeholder = { Text(AskOpenCodeIntent.REQUEST_VALUE_DIALOG) },
+ label = AskOpenCodeIntent.MESSAGE_TITLE,
+ placeholder = AskOpenCodeIntent.REQUEST_VALUE_DIALOG,
minLines = 2,
maxLines = 6,
enabled = !state.isSending,
diff --git a/feature/system/src/main/kotlin/ai/opencode/feature/system/share/ShareView.kt b/feature/system/src/main/kotlin/ai/opencode/feature/system/share/ShareView.kt
index 3804f9f33..e135cfcaa 100644
--- a/feature/system/src/main/kotlin/ai/opencode/feature/system/share/ShareView.kt
+++ b/feature/system/src/main/kotlin/ai/opencode/feature/system/share/ShareView.kt
@@ -1,5 +1,10 @@
package ai.opencode.feature.system.share
+import ai.opencode.core.ui.OpenCodeSearchField
+import ai.opencode.core.ui.OpenCodeSheetDefaults
+import ai.opencode.core.ui.OpenCodeSheetHandle
+import ai.opencode.core.ui.OpenCodeRadius
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.motion.transitionBlur
import ai.opencode.core.files.AttachmentFileType
@@ -72,7 +77,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.verticalScroll
-import androidx.compose.material3.AlertDialog
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenu
@@ -194,7 +199,7 @@ fun ShareView(state: ShareModel.State, actions: ShareActions) {
}
state.saveError?.let { error ->
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = actions.onDismissSaveError,
title = { Text("Couldn’t Save for OpenCode") },
text = { Text(error) },
@@ -383,12 +388,12 @@ private fun Status(state: ShareModel.State, actions: ShareActions, reduceMotion:
when (val current = shown[0]) {
is ShareModel.Phase.Failed -> {
Text(current.problem.message, style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.SemiBold), modifier = Modifier.weight(1f))
- FilledTonalButton(onClick = actions.onSendLater) { Text("Send Later") }
- if (current.problem.canRetry) Button(onClick = actions.onSend) { Text("Try Again") }
+ FilledTonalButton(onClick = actions.onSendLater, shape = OpenCodeShape.control) { Text("Send Later") }
+ if (current.problem.canRetry) Button(onClick = actions.onSend, shape = OpenCodeShape.control) { Text("Try Again") }
}
else -> {
Text("Saved. Open OpenCode to continue", style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.SemiBold), modifier = Modifier.weight(1f))
- Button(onClick = actions.onDone) { Text("Done") }
+ Button(onClick = actions.onDone, shape = OpenCodeShape.control) { Text("Done") }
}
}
}
@@ -527,7 +532,7 @@ private fun Images(images: List, height: Dp) {
bitmap = bitmap,
contentDescription = "Image",
contentScale = ContentScale.Fit,
- modifier = Modifier.heightIn(max = height).clip(RoundedCornerShape(18.dp)),
+ modifier = Modifier.heightIn(max = height).clip(RoundedCornerShape(OpenCodeRadius.card)),
)
} else if (images.isNotEmpty()) {
LazyRow(
@@ -540,7 +545,7 @@ private fun Images(images: List, height: Dp) {
bitmap = bitmap,
contentDescription = "Image ${index + 1} of ${images.size}",
contentScale = ContentScale.Fit,
- modifier = Modifier.heightIn(max = minOf(height, 300.dp)).clip(RoundedCornerShape(16.dp)),
+ modifier = Modifier.heightIn(max = minOf(height, 300.dp)).clip(RoundedCornerShape(OpenCodeRadius.card)),
)
}
}
@@ -552,7 +557,7 @@ private fun Card(modifier: Modifier = Modifier, content: @Composable () -> Unit)
Box(
modifier
.fillMaxWidth()
- .background(OpenCodeTheme.colors.userBubble, RoundedCornerShape(14.dp))
+ .background(OpenCodeTheme.colors.userBubble, RoundedCornerShape(OpenCodeRadius.card))
.padding(14.dp),
) {
content()
@@ -710,7 +715,7 @@ private fun Chip(
val foreground = if (selected) colors.canvas else colors.text
Box(
Modifier
- .clip(OpenCodeShape.capsule)
+ .clip(OpenCodeShape.control)
.clickable(onClickLabel = hint, role = Role.Button, onClick = onClick)
.openCodeTapTarget(accessibility = false)
.semantics {
@@ -723,7 +728,7 @@ private fun Chip(
Modifier
.clearAndSetSemantics {}
.height(36.dp)
- .background(container, OpenCodeShape.capsule)
+ .background(container, OpenCodeShape.control)
.padding(horizontal = 14.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(5.dp),
@@ -774,8 +779,10 @@ private fun MessageBar(state: ShareModel.State, actions: ShareActions, reduceMot
Surface(
modifier = modifier.fillMaxWidth(),
- shape = RoundedCornerShape(26.dp),
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
+ // The desktop dock: 12 dp corners, floating fill, hairline ring.
+ shape = RoundedCornerShape(OpenCodeRadius.panel),
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
contentColor = colors.text,
) {
Row(verticalAlignment = Alignment.Bottom, horizontalArrangement = Arrangement.spacedBy(4.dp)) {
@@ -958,7 +965,13 @@ private fun ShareSessionSearch(
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
var query by rememberSaveable { mutableStateOf("") }
val colors = OpenCodeTheme.colors
- ModalBottomSheet(onDismissRequest = onClose, sheetState = sheetState, containerColor = colors.groupedCanvas) {
+ ModalBottomSheet(
+ onDismissRequest = onClose,
+ sheetState = sheetState,
+ containerColor = colors.groupedCanvas,
+ dragHandle = { OpenCodeSheetHandle() },
+ shape = OpenCodeSheetDefaults.shape,
+ ) {
Box(Modifier.fillMaxWidth().padding(horizontal = 4.dp)) {
OpenCodeIconButton(
symbol = SFSymbol.Xmark,
@@ -969,30 +982,12 @@ private fun ShareSessionSearch(
)
Text("Sessions", style = OpenCodeTextStyles.headline, modifier = Modifier.align(Alignment.Center))
}
- Surface(
+ OpenCodeSearchField(
+ value = query,
+ onValueChange = { query = it },
+ placeholder = "Search",
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp),
- shape = OpenCodeShape.fill,
- color = colors.inlineCodeFill,
- ) {
- Row(Modifier.padding(horizontal = 12.dp, vertical = 10.dp), verticalAlignment = Alignment.CenterVertically) {
- OpenCodeIcon(SFSymbol.Magnifyingglass, contentDescription = null, size = OpenCodeIconSize.small, tint = colors.secondaryText)
- Spacer(Modifier.width(8.dp))
- BasicTextField(
- value = query,
- onValueChange = { query = it },
- singleLine = true,
- textStyle = OpenCodeTextStyles.body.copy(color = colors.text),
- cursorBrush = SolidColor(colors.accent),
- modifier = Modifier.weight(1f),
- decorationBox = { inner ->
- Box {
- if (query.isEmpty()) Text("Search", style = OpenCodeTextStyles.body, color = colors.tertiaryText)
- inner()
- }
- },
- )
- }
- }
+ )
val pinned = matches(state.targets?.pinned ?: emptyList(), query)
val recents = matches(state.targets?.recents ?: emptyList(), query)
LazyColumn(Modifier.fillMaxWidth(), contentPadding = PaddingValues(bottom = 24.dp)) {
diff --git a/feature/system/src/main/kotlin/ai/opencode/feature/system/widgets/OpenCodeControls.kt b/feature/system/src/main/kotlin/ai/opencode/feature/system/widgets/OpenCodeControls.kt
index db6d08df7..5db501e02 100644
--- a/feature/system/src/main/kotlin/ai/opencode/feature/system/widgets/OpenCodeControls.kt
+++ b/feature/system/src/main/kotlin/ai/opencode/feature/system/widgets/OpenCodeControls.kt
@@ -1,5 +1,12 @@
package ai.opencode.feature.system.widgets
+import ai.opencode.core.sharing.shared
+import ai.opencode.core.ui.AppTheme
+import ai.opencode.core.ui.OpenCodeColors
+import ai.opencode.core.ui.ThemeSharedKeys
+import ai.opencode.core.ui.toColorScheme
+import androidx.glance.color.ColorProviders
+import androidx.glance.material3.ColorProviders as MaterialColorProviders
import ai.opencode.core.log.AppLog
import ai.opencode.core.ui.SFSymbol
import ai.opencode.feature.system.ControlDirectoryStore
@@ -166,7 +173,7 @@ abstract class OpenCodeControlWidget : GlanceAppWidget() {
val preferences = currentState()
val entity = OpenCodeControls.chosenEntity(preferences)
val value = SessionControlValue.of(entity, directory)
- GlanceTheme {
+ GlanceTheme(colors = widgetColors()) {
ControlButton(
symbol = symbol(value),
title = title(value),
@@ -221,12 +228,27 @@ class NewSessionWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = NewSessionWidget()
}
+/**
+ * The app's theme for widgets: the chosen curated theme's colours (the OpenCode desktop palette by
+ * default), or the wallpaper's dynamic colours for System. Read when the widget renders.
+ */
+@Composable
+private fun widgetColors(): ColorProviders {
+ val theme = shared(ThemeSharedKeys.appTheme).value
+ if (theme == AppTheme.System) return GlanceTheme.colors
+ return MaterialColorProviders(
+ light = OpenCodeColors.resolve(theme, isDark = false).toColorScheme(),
+ dark = OpenCodeColors.resolve(theme, isDark = true).toColorScheme(),
+ )
+}
+
@Composable
private fun ControlButton(symbol: SFSymbol, title: String, detail: String?, description: String, intent: Intent) {
Row(
modifier = GlanceModifier.fillMaxSize()
.background(GlanceTheme.colors.secondaryContainer)
- .cornerRadius(28.dp)
+ // The desktop dock's 12 dp corners (iOS's control is a 28 pt capsule).
+ .cornerRadius(12.dp)
.padding(horizontal = 16.dp, vertical = 8.dp)
.clickable(actionStartActivity(intent))
.semantics { contentDescription = description },
diff --git a/feature/system/src/main/kotlin/ai/opencode/feature/system/widgets/SessionWidgetConfigurationActivity.kt b/feature/system/src/main/kotlin/ai/opencode/feature/system/widgets/SessionWidgetConfigurationActivity.kt
index ad26bd9f2..be8c3910d 100644
--- a/feature/system/src/main/kotlin/ai/opencode/feature/system/widgets/SessionWidgetConfigurationActivity.kt
+++ b/feature/system/src/main/kotlin/ai/opencode/feature/system/widgets/SessionWidgetConfigurationActivity.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.system.widgets
+import ai.opencode.core.ui.OpenCodeSearchField
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.feature.system.LeftToRight
import ai.opencode.core.ui.OpenCodeAppTheme
import ai.opencode.core.ui.OpenCodeIcon
@@ -34,7 +36,6 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -115,12 +116,14 @@ private fun ChooseSessionView(directory: SessionDirectory, onChoose: (SessionEnt
Box(Modifier.fillMaxSize().safeDrawingPadding().imePadding(), contentAlignment = Alignment.Center) {
Surface(
modifier = Modifier.padding(16.dp).widthIn(max = 560.dp).fillMaxWidth().heightIn(max = 640.dp),
- shape = MaterialTheme.shapes.extraLarge,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
+ // The desktop dialog: floating fill, hairline ring, 12 dp corners, no tonal elevation.
+ shape = OpenCodeSurfaces.dialogShape,
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
// Explicit: `contentColorFor` matches roles by value, and the container shares its
// colour with a role whose content colour is dim (as Ask OpenCode's dialog).
contentColor = MaterialTheme.colorScheme.onSurface,
- tonalElevation = 6.dp,
+ tonalElevation = 0.dp,
) {
Column {
Row(Modifier.fillMaxWidth().padding(start = 24.dp, end = 8.dp, top = 8.dp), verticalAlignment = Alignment.CenterVertically) {
@@ -131,12 +134,10 @@ private fun ChooseSessionView(directory: SessionDirectory, onChoose: (SessionEnt
)
OpenCodeIconButton(SFSymbol.Xmark, contentDescription = "Close", onClick = onClose, style = OpenCodeIconButtonStyle.Standard)
}
- OutlinedTextField(
+ OpenCodeSearchField(
value = query,
onValueChange = { query = it },
- placeholder = { Text("Search") },
- leadingIcon = { OpenCodeIcon(SFSymbol.Magnifyingglass, contentDescription = null) },
- singleLine = true,
+ placeholder = "Search",
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp),
)
LazyColumn(Modifier.fillMaxWidth(), contentPadding = PaddingValues(bottom = 8.dp)) {
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/TranscriptTunables.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/TranscriptTunables.kt
index 3c78ef48f..5c32e35ae 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/TranscriptTunables.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/TranscriptTunables.kt
@@ -90,20 +90,20 @@ object TranscriptTunables {
val turnHalf = Tunable("transcript.row.turnHalf", "Turn half-gap", default = 12f, range = 4.0..28.0, step = 1.0)
val sectionHalf = Tunable("transcript.row.sectionHalf", "Section rule half-gap", default = 16f, range = 6.0..36.0, step = 1.0)
val contentGutter = Tunable("transcript.row.contentGutter", "Horizontal gutter", default = 16f, range = 8.0..32.0, step = 1.0)
- val bubbleVertical = Tunable("transcript.bubble.verticalPadding", "Bubble vertical padding", default = 10f, range = 6.0..20.0, step = 1.0)
- val bubbleCornerRadius = Tunable("transcript.bubble.cornerRadius", "Bubble corner radius", default = 18f, range = 8.0..28.0, step = 1.0)
- val bubbleMaxFraction = Tunable("transcript.bubble.maxFraction", "Bubble max width", default = 0.78f, range = 0.55..0.95, step = 0.01)
- val cardCornerRadius = Tunable("transcript.card.cornerRadius", "Card corner radius", default = 14f, range = 6.0..24.0, step = 1.0)
+ val bubbleVertical = Tunable("transcript.bubble.verticalPadding", "Bubble vertical padding", default = 8f, range = 6.0..20.0, step = 1.0)
+ val bubbleCornerRadius = Tunable("transcript.bubble.cornerRadius", "Bubble corner radius", default = 10f, range = 8.0..28.0, step = 1.0)
+ val bubbleMaxFraction = Tunable("transcript.bubble.maxFraction", "Bubble max width", default = 0.82f, range = 0.55..0.95, step = 0.01)
+ val cardCornerRadius = Tunable("transcript.card.cornerRadius", "Card corner radius", default = 8f, range = 6.0..24.0, step = 1.0)
// Typography (D-52)
- val bodySize = Tunable("transcript.typography.bodySize", "Body size (pt)", default = 17f, range = 14.0..20.0, step = 0.5)
+ val bodySize = Tunable("transcript.typography.bodySize", "Body size (pt)", default = 15f, range = 14.0..20.0, step = 0.5)
val bodyLeading = Tunable("transcript.typography.bodyLeading", "Body leading (pt)", default = 4.5f, range = 0.0..8.0, step = 0.5)
val bodyTone = Tunable("transcript.typography.bodyTone", "Body tone", default = 0.92, range = 0.75..1.0, step = 0.01)
- val h1Size = Tunable("transcript.typography.h1Size", "H1 size (pt)", default = 22f, range = 18.0..28.0, step = 1.0)
- val h2Size = Tunable("transcript.typography.h2Size", "H2 size (pt)", default = 20f, range = 16.0..24.0, step = 1.0)
- val h3Size = Tunable("transcript.typography.h3Size", "H3 size (pt)", default = 18f, range = 12.0..20.0, step = 0.5)
+ val h1Size = Tunable("transcript.typography.h1Size", "H1 size (pt)", default = 19f, range = 18.0..28.0, step = 1.0)
+ val h2Size = Tunable("transcript.typography.h2Size", "H2 size (pt)", default = 17f, range = 16.0..24.0, step = 1.0)
+ val h3Size = Tunable("transcript.typography.h3Size", "H3 size (pt)", default = 15f, range = 12.0..20.0, step = 0.5)
val h3Weight = Tunable("transcript.typography.h3Weight", "H3 weight", default = TranscriptFontWeight.Bold)
- val metaSize = Tunable("transcript.typography.metaSize", "Used N & Working size (pt)", default = 17f, range = 11.0..17.0, step = 0.5)
+ val metaSize = Tunable("transcript.typography.metaSize", "Used N & Working size (pt)", default = 14f, range = 11.0..17.0, step = 0.5)
val listNumSize = Tunable("transcript.typography.listNumSize", "List number size (pt)", default = 13f, range = 11.0..17.0, step = 0.5)
val codeLeading = Tunable("transcript.typography.codeLeading", "Code leading (pt)", default = 3f, range = 0.0..6.0, step = 0.5)
/** `0` inherits `flowHalf * 2`; any positive value is used directly. */
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/links/LinkPreviewViews.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/links/LinkPreviewViews.kt
index f54270bc7..ae07966e3 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/links/LinkPreviewViews.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/links/LinkPreviewViews.kt
@@ -92,7 +92,7 @@ import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.withStyle
@@ -705,7 +705,7 @@ private fun DetailSiteLine(summary: LinkPreviewSummary, palette: LinkPreviewPale
// Only a SHA changes face, and it keeps the caption's size.
Text(
reference,
- style = if (summary.referenceIsCode) style.copy(fontFamily = FontFamily.Monospace) else style,
+ style = if (summary.referenceIsCode) style.copy(fontFamily = OpenCodeFonts.monospace) else style,
color = palette.tertiary,
maxLines = 1,
softWrap = false,
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownBand.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownBand.kt
index bd9a89a1d..19364063f 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownBand.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownBand.kt
@@ -3,11 +3,11 @@ package ai.opencode.feature.transcript.markdown.ui
import ai.opencode.core.ui.OpenCodeColors
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.core.ui.drawerPanHorizontalScroller
-import ai.opencode.feature.transcript.LocalTranscriptLayoutTuning
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.background
+import androidx.compose.foundation.border
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -15,10 +15,12 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
@@ -33,11 +35,22 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import ai.opencode.core.motion.Motion
-/** What every transcript band shares: code, tables, and opened inline rows (iOS `TranscriptBandStyle`). */
+/**
+ * What every transcript band shares: code, tables, and opened inline rows. On this branch a band
+ * is the desktop's inset block (`markdown.css` `.highlights`, `message-part.css` tool output): a
+ * faint fill inside a hairline border with small rounded corners, at the prose's width rather
+ * than iOS's full-bleed band between hairlines.
+ */
object TranscriptBandStyle {
- /** From a hairline to the content's first line box. */
+ /** From the border to the content's first line box. */
val verticalPadding: Dp = 12.dp
+ /** The content's inset from the border (desktop `padding: 12px`). */
+ val horizontalPadding: Dp = 12.dp
+
+ /** Desktop `--radius-md`-ish block corners. */
+ val cornerRadius: Dp = 8.dp
+
fun fill(colors: OpenCodeColors): Color = colors.codeBand
}
@@ -100,9 +113,8 @@ class TableRules {
}
/**
- * Code and tables run the screen's full width on a faint band between hairlines (iOS
- * `MarkdownBand`). Content starts at the prose edge and scrolls out to the screen edges,
- * fading where more lies past them. A table's rules keep the viewport's width while its
+ * Code and tables sit in the desktop's inset block (iOS draws a full-width `MarkdownBand`).
+ * Content scrolls horizontally inside the block, fading where more lies past it. A table's rules keep the viewport's width while its
* columns scroll underneath.
*/
@Composable
@@ -112,15 +124,16 @@ fun MarkdownBand(
content: @Composable () -> Unit,
) {
val colors = OpenCodeTheme.colors
- val gutter = LocalTranscriptLayoutTuning.current.contentGutter.dp
val scroll = rememberScrollState()
val hairline = with(LocalDensity.current) { 1f.toDp() }
- Column(modifier.bleedHorizontal(gutter)) {
- HairlineRule()
+ Column(modifier) {
+ val shape = RoundedCornerShape(TranscriptBandStyle.cornerRadius)
Box(
Modifier
.fillMaxWidth()
+ .clip(shape)
.background(TranscriptBandStyle.fill(colors))
+ .border(hairline, colors.border, shape)
.padding(vertical = TranscriptBandStyle.verticalPadding)
.drawWithContent {
drawContent()
@@ -140,9 +153,8 @@ fun MarkdownBand(
.drawerPanHorizontalScroller(scroll)
.horizontalOverflowFade(scroll, width = 32.dp)
.horizontalScroll(scroll)
- .padding(horizontal = gutter),
+ .padding(horizontal = TranscriptBandStyle.horizontalPadding),
) { content() }
}
- HairlineRule()
}
}
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownBlockView.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownBlockView.kt
index 761be1310..134f7c2f0 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownBlockView.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownBlockView.kt
@@ -9,7 +9,6 @@ import ai.opencode.feature.media.LocalLinkPreviewRevision
import ai.opencode.feature.media.LocalLinkPreviewStore
import ai.opencode.feature.media.MermaidDiagramCard
import ai.opencode.feature.media.TranscriptMetrics
-import ai.opencode.feature.transcript.LocalTranscriptLayoutTuning
import ai.opencode.feature.transcript.LocalTranscriptRowContext
import ai.opencode.feature.transcript.TranscriptAction
import ai.opencode.feature.transcript.markdown.InlineText
@@ -91,7 +90,6 @@ fun MarkdownBlockView(
private fun BlockContent(kind: Kind, grown: List, isGrowingTail: Boolean, selection: TranscriptSelectionLeafKey?) {
val style = currentMarkdownStyle()
val colors = style.colors
- val gutter = LocalTranscriptLayoutTuning.current.contentGutter.dp
val context = LocalTranscriptRowContext.current
val send = context.send
when (kind) {
@@ -112,8 +110,8 @@ private fun BlockContent(kind: Kind, grown: List,
}
is Kind.Paragraph -> BlockText(kind, kind.text, style.bodyStyle, style.bodyColor, grown, isGrowingTail, selection)
Kind.Divider ->
- // Runs the screen's full width, like the code and table bands, with the block gap on each side.
- HairlineRule(Modifier.bleedHorizontal(gutter).clearAndSetSemantics {})
+ // At the prose's width, like the desktop's `hr`, with the block gap on each side.
+ HairlineRule(Modifier.clearAndSetSemantics {})
is Kind.PullRequest -> PullRequestCard(kind.title, kind.url) { send(TranscriptAction.LinkTapped(kind.url)) }
is Kind.Files -> FileCards(kind.files)
// A Markdown image outside the session's folder loads through that folder's location once
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownStyle.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownStyle.kt
index f88dcbf68..ec9ef40fd 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownStyle.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownStyle.kt
@@ -69,11 +69,12 @@ class MarkdownStyle(
1 -> tuning.h1Size
2 -> tuning.h2Size
3 -> tuning.h3Size
- else -> 17f
+ // Deeper headings stay at H3's desktop size (iOS: `.headline` 17).
+ else -> 15f
}
fun headingWeight(level: Int): FontWeight = when (level) {
- 1 -> FontWeight.Bold
+ 1 -> FontWeight.SemiBold
2 -> FontWeight.SemiBold
3 -> tuning.h3Weight
else -> FontWeight.SemiBold
@@ -116,12 +117,12 @@ class MarkdownStyle(
val listIndent: Dp = 20.dp
/** The default body size, for surfaces without a tuning snapshot (display math). */
- val bodyTextSize: TextUnit = 17.sp
+ val bodyTextSize: TextUnit = 15.sp
/** iOS `TranscriptMetrics.codeFont` (`.subheadline.monospaced()`) with `codeLeading` (3) between lines. */
- fun codeTextStyle(codeLeading: Float = 3f): TextStyle = OpenCodeTextStyles.subheadline.copy(
+ fun codeTextStyle(codeLeading: Float = 3f): TextStyle = OpenCodeTextStyles.footnote.copy(
fontFamily = OpenCodeFonts.monospace,
- lineHeight = (20f + codeLeading).sp,
+ lineHeight = (18f + codeLeading).sp,
lineHeightStyle = LineHeightStyle(LineHeightStyle.Alignment.Proportional, LineHeightStyle.Trim.Both),
lineBreak = LineBreak.Simple,
hyphens = Hyphens.None,
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownTable.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownTable.kt
index c0fd4808d..b2352664d 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownTable.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/MarkdownTable.kt
@@ -5,6 +5,7 @@ import ai.opencode.feature.media.TranscriptMetrics
import ai.opencode.feature.transcript.markdown.InlineText
import ai.opencode.feature.transcript.selection.TranscriptSelectionLeafKey
import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@@ -15,10 +16,15 @@ import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.dp
/**
- * A table on the full-width band (iOS `MarkdownTable`). Columns size to their content up to
- * 220 (iOS `CappedWidthLayout`: short cells keep their natural width, longer ones wrap). Rules
- * under the header and between rows run the band's full width and stay put while the columns
- * scroll.
+ * A table in the transcript's inset block (iOS `MarkdownTable`). Columns size to their content up
+ * to 220 (iOS `CappedWidthLayout`: short cells keep their natural width, longer ones wrap). When
+ * that's wider than the block, the columns shrink to fit it, as the desktop's (browser) table
+ * layout does, but never below a readable floor (112, or the column's natural width if smaller,
+ * and never below its longest word). A table that still doesn't fit scrolls, with the next column
+ * peeking in under the edge fade. Unshrunk, a three-column table hid its last column entirely
+ * past the block's edge.
+ * Rules under the header and between rows run the block's full width and stay put while the
+ * columns scroll.
*
* @param selection the block's key in a reply: each cell joins the reply's one selection (its
* part is [TranscriptSelectionLeafKey.tablePart]). Elsewhere cells aren't selectable, as on iOS.
@@ -36,7 +42,9 @@ fun MarkdownTable(
val targets = LocalSessionLinks.current.targets
val listener = rememberLinkListener()
val rules = remember { TableRules() }
- val cellStyle = OpenCodeTextStyles.subheadline.copy(fontFeatureSettings = "tnum")
+ // No `tnum` (iOS `monospacedDigit()`): Inter's tabular set also widens the hyphen, which
+ // opened a gap in words like "mid-sentence", and left-aligned cells don't line digits up anyway.
+ val cellStyle = OpenCodeTextStyles.subheadline
val headerStyle = cellStyle.copy(fontWeight = FontWeight.SemiBold)
fun present(cell: InlineText, isHeader: Boolean) = MarkdownPresentation.present(
cell,
@@ -51,60 +59,92 @@ fun MarkdownTable(
val presentedRows = remember(rows, targets, colors, density) { rows.map { row -> row.map { present(it, false) } } }
ReportsSessionLinks((presentedHeader + presentedRows.flatten()).flatMap { it.sessionIDs }.distinct())
val columns = maxOf(header.size, rows.maxOfOrNull { it.size } ?: 0)
- MarkdownBand(modifier, rules = rules) {
- Layout(
- content = {
- for ((rowIndex, row) in (listOf(presentedHeader) + presentedRows).withIndex()) {
- for (column in 0 until columns) {
- val cell = row.getOrNull(column)
- val isHeader = row === presentedHeader
- if (cell == null) {
- Box(Modifier)
- } else {
- val key = selection?.copy(part = TranscriptSelectionLeafKey.tablePart(rowIndex, column))
- ArrivingText(
- cell, emptyList(), if (isHeader) headerStyle else cellStyle, if (isHeader) colors.secondaryText else colors.text,
- selectionKey = key,
- )
+ BoxWithConstraints(modifier) {
+ val viewport = maxWidth - TranscriptBandStyle.horizontalPadding * 2
+ MarkdownBand(rules = rules) {
+ Layout(
+ content = {
+ for ((rowIndex, row) in (listOf(presentedHeader) + presentedRows).withIndex()) {
+ for (column in 0 until columns) {
+ val cell = row.getOrNull(column)
+ val isHeader = row === presentedHeader
+ if (cell == null) {
+ Box(Modifier)
+ } else {
+ val key = selection?.copy(part = TranscriptSelectionLeafKey.tablePart(rowIndex, column))
+ ArrivingText(
+ cell, emptyList(), if (isHeader) headerStyle else cellStyle, if (isHeader) colors.secondaryText else colors.text,
+ selectionKey = key,
+ )
+ }
}
}
+ },
+ ) { measurables, _ ->
+ val cap = 220.dp.roundToPx()
+ val floor = 112.dp.roundToPx()
+ val hSpacing = TranscriptMetrics.turn.roundToPx()
+ val vSpacing = TranscriptMetrics.bubbleVertical.roundToPx()
+ val rule = (0.5.dp).roundToPx().coerceAtLeast(1)
+ val rowCount = measurables.size / maxOf(columns, 1)
+ // Each column's natural width (its widest cell, capped) and its narrowest: its longest
+ // word, and at least the readable floor, so a squeezed column never wraps word by word.
+ val widest = IntArray(columns)
+ val narrowest = IntArray(columns)
+ for ((index, measurable) in measurables.withIndex()) {
+ val column = index % maxOf(columns, 1)
+ val natural = minOf(measurable.maxIntrinsicWidth(Constraints.Infinity), cap)
+ val word = minOf(measurable.minIntrinsicWidth(Constraints.Infinity), natural)
+ val readable = maxOf(word, minOf(natural, floor))
+ widest[column] = maxOf(widest[column], natural)
+ narrowest[column] = maxOf(narrowest[column], readable)
}
- },
- ) { measurables, _ ->
- val cap = 220.dp.roundToPx()
- val hSpacing = TranscriptMetrics.turn.roundToPx()
- val vSpacing = TranscriptMetrics.bubbleVertical.roundToPx()
- val rule = (0.5.dp).roundToPx().coerceAtLeast(1)
- val rowCount = measurables.size / maxOf(columns, 1)
- val placeables = measurables.map { measurable ->
- val width = minOf(measurable.maxIntrinsicWidth(Constraints.Infinity), cap)
- measurable.measure(Constraints(minWidth = 0, maxWidth = width.coerceAtLeast(0)))
- }
- val widths = IntArray(columns) { column -> (0 until rowCount).maxOfOrNull { placeables[it * columns + column].width } ?: 0 }
- val heights = IntArray(rowCount) { row -> (0 until columns).maxOfOrNull { placeables[row * columns + it].height } ?: 0 }
- val tops = IntArray(rowCount)
- val ruleTops = mutableListOf()
- var y = 0
- for (row in 0 until rowCount) {
- if (row > 0) {
- y += vSpacing
- ruleTops += y.toFloat()
- y += rule + vSpacing
+ val room = viewport.roundToPx() - hSpacing * (columns - 1).coerceAtLeast(0)
+ val widestTotal = widest.sum()
+ val narrowestTotal = narrowest.sum()
+ val columnWidths = IntArray(columns)
+ for (column in 0 until columns) {
+ columnWidths[column] = when {
+ widestTotal <= room -> widest[column]
+ narrowestTotal >= room -> narrowest[column]
+ else -> {
+ // Share the room past every column's longest word in proportion to how much more each wants.
+ val share = (room - narrowestTotal).toFloat() / (widestTotal - narrowestTotal)
+ narrowest[column] + ((widest[column] - narrowest[column]) * share).toInt()
+ }
+ }
}
- tops[row] = y
- y += heights[row]
- }
- val totalWidth = widths.sum() + hSpacing * (columns - 1).coerceAtLeast(0)
- rules.offsets = ruleTops
- layout(totalWidth, y) {
+ val placeables = measurables.mapIndexed { index, measurable ->
+ val width = columnWidths[index % maxOf(columns, 1)]
+ measurable.measure(Constraints(minWidth = 0, maxWidth = width.coerceAtLeast(0)))
+ }
+ val widths = IntArray(columns) { column -> (0 until rowCount).maxOfOrNull { placeables[it * columns + column].width } ?: 0 }
+ val heights = IntArray(rowCount) { row -> (0 until columns).maxOfOrNull { placeables[row * columns + it].height } ?: 0 }
+ val tops = IntArray(rowCount)
+ val ruleTops = mutableListOf()
+ var y = 0
for (row in 0 until rowCount) {
- var x = 0
- for (column in 0 until columns) {
- placeables[row * columns + column].place(x, tops[row])
- x += widths[column] + hSpacing
+ if (row > 0) {
+ y += vSpacing
+ ruleTops += y.toFloat()
+ y += rule + vSpacing
+ }
+ tops[row] = y
+ y += heights[row]
+ }
+ val totalWidth = widths.sum() + hSpacing * (columns - 1).coerceAtLeast(0)
+ rules.offsets = ruleTops
+ layout(totalWidth, y) {
+ for (row in 0 until rowCount) {
+ var x = 0
+ for (column in 0 until columns) {
+ placeables[row * columns + column].place(x, tops[row])
+ x += widths[column] + hSpacing
+ }
}
}
}
}
}
}
+
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/TranscriptBand.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/TranscriptBand.kt
index 894e62a7f..77a69b9bd 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/TranscriptBand.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/markdown/ui/TranscriptBand.kt
@@ -4,7 +4,6 @@ import ai.opencode.core.motion.Motion
import ai.opencode.core.motion.rememberReduceMotion
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.feature.media.TranscriptMetrics
-import ai.opencode.feature.transcript.LocalTranscriptLayoutTuning
import ai.opencode.feature.transcript.TranscriptTunables
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
@@ -27,8 +26,10 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.draw.drawWithContent
+import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.Layout
@@ -155,26 +156,28 @@ fun TranscriptBand(
) {
val colors = OpenCodeTheme.colors
val reduceMotion = rememberReduceMotion()
- val gutter = LocalTranscriptLayoutTuning.current.contentGutter.dp
val hairline = with(LocalDensity.current) { 1f.toDp() }
val rise = with(LocalDensity.current) { 6.dp.toPx() }
Box(
modifier
- .bleedHorizontal(gutter)
.fillMaxWidth()
.drawBehind {
val r = reveal()
if (r <= 0.001f) return@drawBehind
val grow = if (reduceMotion) 1f else r
val px = hairline.toPx()
- val height = maxOf(size.height * grow, px)
+ val height = maxOf(size.height * grow, 2 * px)
val alpha = r
- drawRect(colors.border.copy(alpha = colors.border.alpha * alpha), Offset.Zero, Size(size.width, px))
- drawRect(
+ val radius = CornerRadius(TranscriptBandStyle.cornerRadius.toPx())
+ // The desktop's inset block, drawn down to the band's growing edge.
+ drawRoundRect(
TranscriptBandStyle.fill(colors).copy(alpha = TranscriptBandStyle.fill(colors).alpha * alpha),
- Offset(0f, px), Size(size.width, maxOf(0f, height - 2 * px)),
+ Offset.Zero, Size(size.width, height), radius,
+ )
+ drawRoundRect(
+ colors.border.copy(alpha = colors.border.alpha * alpha),
+ Offset(px / 2, px / 2), Size(size.width - px, height - px), radius, style = Stroke(px),
)
- drawRect(colors.border.copy(alpha = colors.border.alpha * alpha), Offset(0f, maxOf(0f, height - px)), Size(size.width, px))
}
.drawWithContent {
val r = reveal()
@@ -182,8 +185,8 @@ fun TranscriptBand(
// The mask: drawn only as far as the band's edge.
clipRect(bottom = size.height * grow) { this@drawWithContent.drawContent() }
}
- .padding(vertical = hairline)
- .padding(horizontal = gutter, vertical = verticalPadding),
+ .padding(hairline)
+ .padding(horizontal = TranscriptBandStyle.horizontalPadding, vertical = verticalPadding),
) {
Box(
Modifier.graphicsLayer {
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/RowModifiers.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/RowModifiers.kt
index 81be6777b..52d173a40 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/RowModifiers.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/RowModifiers.kt
@@ -19,7 +19,7 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
@@ -35,10 +35,10 @@ import kotlin.math.roundToInt
/** iOS `TranscriptMetrics` fonts (`codeFont`, `toolFont`, `metaFont`). */
object TranscriptFonts {
/** Markdown code blocks and request commands: one mono family, sized to sit beside 17 pt body text. */
- val codeFont: TextStyle = OpenCodeTextStyles.subheadline.copy(fontFamily = FontFamily.Monospace)
+ val codeFont: TextStyle = OpenCodeTextStyles.subheadline.copy(fontFamily = OpenCodeFonts.monospace)
/** Denser tool commands, arguments, and output (the desktop app's 13 pt). */
- val toolFont: TextStyle = OpenCodeTextStyles.footnote.copy(fontFamily = FontFamily.Monospace)
+ val toolFont: TextStyle = OpenCodeTextStyles.footnote.copy(fontFamily = OpenCodeFonts.monospace)
/** Used N, answered question rows, and Working (`metaSize`; 17 pt body by default). */
@Composable
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/RunErrorRow.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/RunErrorRow.kt
index b6ee9382b..4d3ad1752 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/RunErrorRow.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/RunErrorRow.kt
@@ -169,7 +169,7 @@ fun RunErrorRow(
private fun RunErrorAction(action: OpenCodeRunError.Action, modifier: Modifier, onClick: () -> Unit) {
val colors = OpenCodeTheme.colors
Row(
- modifier.rowHitTarget(target = Modifier.clip(OpenCodeShape.capsule).clickable(role = Role.Button, onClick = onClick)),
+ modifier.rowHitTarget(target = Modifier.clip(OpenCodeShape.control).clickable(role = Role.Button, onClick = onClick)),
horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
@@ -206,7 +206,7 @@ fun UndoneRow(redo: () -> Unit, modifier: Modifier = Modifier) {
Modifier
.alignByBaseline()
.rowHitTarget(
- target = Modifier.clip(OpenCodeShape.capsule).clickable(
+ target = Modifier.clip(OpenCodeShape.control).clickable(
role = Role.Button,
onClickLabel = "Restore the reverted messages and files until you send a new message",
onClick = redo,
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/ToolRows.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/ToolRows.kt
index 053f28ced..fa78c17d8 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/ToolRows.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/ToolRows.kt
@@ -32,6 +32,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
@@ -55,6 +56,7 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
+import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.withStyle
@@ -125,7 +127,7 @@ internal fun SubagentToolView(call: OpenCodeToolCall, subagents: Map 0) withStyle(SpanStyle(color = colors.destructive)) { append(" · ${header.failed} failed") }
+ if (header.failed > 0) withStyle(SpanStyle(color = colors.danger)) { append(" · ${header.failed} failed") }
header.cue?.let { withStyle(SpanStyle(color = colors.secondaryText)) { append(" · $it") } }
}
Text(text, modifier, style = style)
@@ -159,11 +161,19 @@ private fun InlineToolGroupHeaderLabel(header: InlineToolGroupHeader, modifier:
// RollingNumber falls back to plain text when it doesn't fit (iOS `ViewThatFits`).
RollingNumber(header.title, style = style, color = colors.secondaryText)
if (header.failed > 0) {
- RollingNumber(" · ${header.failed} failed", style = style, color = colors.destructive)
+ RollingNumber(" · ${header.failed} failed", style = style, color = colors.danger)
}
header.cue?.let {
Text(" · $it", style = style, color = colors.secondaryText, maxLines = 1, softWrap = false)
}
+ // The desktop's disclosure chevron.
+ OpenCodeIcon(
+ if (expanded) "chevron.down" else "chevron.right",
+ contentDescription = null,
+ modifier = Modifier.align(Alignment.CenterVertically).padding(start = 4.dp),
+ size = 16.dp,
+ tint = colors.tertiaryText,
+ )
}
}
}
@@ -184,6 +194,7 @@ internal fun InlineToolGroupView(entry: TranscriptEntry, key: String, tools: Lis
Column(verticalArrangement = Arrangement.spacedBy(TranscriptMetrics.clustered)) {
InlineToolGroupHeaderLabel(
header,
+ isExpanded,
Modifier
.fillMaxWidth()
.rowHitTarget(
@@ -250,20 +261,55 @@ private fun InlineRowDisclosure(entry: TranscriptEntry, row: InlineToolRow, bodi
}
}
-/** A regular-weight name and a muted detail; only commands are mono, and only failures are marked, in red. */
+/**
+ * The desktop's tool row (`basic-tool.css`): a faint tool glyph, a medium-weight name and a muted
+ * detail; only commands are mono, and only failures are marked, in red.
+ */
@Composable
private fun InlineRowLabel(row: InlineToolRow, expanded: Boolean, modifier: Modifier = Modifier) {
val colors = OpenCodeTheme.colors
val style = OpenCodeTextStyles.subheadline
Row(
modifier.fillMaxWidth().padding(vertical = InlineRowMetrics.rowPadding),
- horizontalArrangement = Arrangement.spacedBy(6.dp),
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ verticalAlignment = Alignment.CenterVertically,
) {
+ OpenCodeIcon(
+ toolGlyph(row),
+ contentDescription = null,
+ size = 16.dp,
+ tint = if (row.isFailed) colors.danger else colors.tertiaryText,
+ )
+ Row(Modifier.weight(1f), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
+ InlineRowText(row, expanded, style)
+ }
+ }
+}
+
+/** The tool's glyph, by name (the desktop shows one per tool kind). */
+private fun toolGlyph(row: InlineToolRow): String {
+ if (row.detailIsCommand) return "terminal"
+ val name = row.name.lowercase()
+ return when {
+ "read" in name -> "doc.text"
+ "write" in name -> "doc"
+ "edit" in name || "patch" in name -> "pencil"
+ "grep" in name || "glob" in name || "search" in name || "find" in name || "list" in name -> "magnifyingglass"
+ "fetch" in name || "web" in name -> "globe"
+ "todo" in name -> "checklist"
+ else -> "hammer.fill"
+ }
+}
+
+@Composable
+private fun RowScope.InlineRowText(row: InlineToolRow, expanded: Boolean, style: TextStyle) {
+ val colors = OpenCodeTheme.colors
+ run {
Text(
row.name,
Modifier.alignByBaseline().inlineRowPulse(row.isRunning),
- style = style,
- color = if (row.isFailed) colors.destructive else colors.text,
+ style = style.copy(fontWeight = FontWeight.Medium),
+ color = if (row.isFailed) colors.danger else colors.text,
)
val detail = row.detail
if (detail != null) {
@@ -272,7 +318,7 @@ private fun InlineRowLabel(row: InlineToolRow, expanded: Boolean, modifier: Modi
detail,
Modifier.alignByBaseline().weight(1f, fill = false),
style = if (row.detailIsCommand) TranscriptFonts.toolFont else style,
- color = if (row.isFailed) colors.destructive else colors.secondaryText,
+ color = if (row.isFailed) colors.danger else colors.secondaryText,
maxLines = if (unlimited) Int.MAX_VALUE else 1,
overflow = TextOverflow.Ellipsis,
)
@@ -304,6 +350,9 @@ private fun ToolBody(entry: TranscriptEntry, id: String, call: OpenCodeToolCall)
.padding(end = TranscriptMetrics.compact, bottom = TranscriptMetrics.clustered)
.fillMaxWidth()
.clip(shape)
+ // The page's own fill, so the box stands off the opened group's faint band around it
+ // (on the band's fill it nearly vanished in light).
+ .background(colors.canvas)
.border(0.5.dp, colors.border, shape),
) {
if (hasInput) {
@@ -361,8 +410,8 @@ private fun ToolBody(entry: TranscriptEntry, id: String, call: OpenCodeToolCall)
} else {
call.error?.let { error ->
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
- OpenCodeIcon("exclamationmark.circle.fill", contentDescription = null, Modifier.padding(top = 1.dp), size = 14.dp, tint = colors.destructive)
- SelectionContainer { Text(error, style = TranscriptFonts.toolFont, color = colors.destructive) }
+ OpenCodeIcon("exclamationmark.circle.fill", contentDescription = null, Modifier.padding(top = 1.dp), size = 14.dp, tint = colors.danger)
+ SelectionContainer { Text(error, style = TranscriptFonts.toolFont, color = colors.danger) }
}
}
}
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/TranscriptEntryView.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/TranscriptEntryView.kt
index ab6759721..f6a0194cc 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/TranscriptEntryView.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/TranscriptEntryView.kt
@@ -127,7 +127,7 @@ private fun ItemView(entry: TranscriptEntry, item: OpenCodeTranscriptItem, rowID
item.text,
Modifier.fillMaxWidth(),
style = OpenCodeTextStyles.footnote,
- color = if (item.isError) colors.destructive else colors.secondaryText,
+ color = if (item.isError) colors.danger else colors.secondaryText,
)
is OpenCodeTranscriptItem.RunError ->
@@ -173,8 +173,8 @@ private fun CompactionView(entry: TranscriptEntry, id: String, info: OpenCodeCom
val rule: @Composable (Modifier) -> Unit = { ruleModifier ->
TranscriptRule(
ruleModifier,
- lineColor = if (failed) colors.destructive.copy(alpha = 0.5f) else quaternaryLine(),
- labelColor = if (failed) colors.destructive else colors.secondaryText,
+ lineColor = if (failed) colors.danger.copy(alpha = 0.5f) else quaternaryLine(),
+ labelColor = if (failed) colors.danger else colors.secondaryText,
) {
if (info.status == OpenCodeCompaction.Status.Running) {
CircularProgressIndicator(Modifier.size(10.dp), color = LocalContentColor.current, strokeWidth = 1.5.dp)
@@ -207,7 +207,7 @@ private fun CompactionView(entry: TranscriptEntry, id: String, info: OpenCodeCom
if (failed) {
info.errorMessage?.let { message ->
SelectionContainer {
- Text(message, Modifier.fillMaxWidth(), style = OpenCodeTextStyles.footnote, color = colors.destructive)
+ Text(message, Modifier.fillMaxWidth(), style = OpenCodeTextStyles.footnote, color = colors.danger)
}
}
}
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/TranscriptRowSlots.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/TranscriptRowSlots.kt
index 3ab35428d..b3c73d044 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/TranscriptRowSlots.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/rows/TranscriptRowSlots.kt
@@ -64,7 +64,7 @@ fun AgentActivityGlyph(state: AgentGlyphState, modifier: Modifier = Modifier) {
Box(modifier.size(state.size), contentAlignment = Alignment.Center) {
when {
state.phase == AgentGlyphState.Phase.Failed ->
- OpenCodeIcon("xmark.circle.fill", contentDescription = null, size = state.size * 0.85f, tint = colors.destructive)
+ OpenCodeIcon("xmark.circle.fill", contentDescription = null, size = state.size * 0.85f, tint = colors.danger)
state.needsInput -> {
val pulse by rememberInfiniteTransition(label = "needsInput").animateFloat(
0.45f, 1f, infiniteRepeatable(tween(1100, easing = LinearEasing), RepeatMode.Reverse), label = "needsInput",
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/user/TranscriptUserBubble.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/user/TranscriptUserBubble.kt
index c91307191..81931fb05 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/user/TranscriptUserBubble.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/user/TranscriptUserBubble.kt
@@ -243,7 +243,7 @@ private fun UserBubbleFace(
},
modifier = modifier
.voiceMessageBackground(VoiceMessageStyle.Standard, isPending, reveal, corners)
- .padding(horizontal = TranscriptMetrics.contentGutter, vertical = TranscriptMetrics.bubbleVertical),
+ .padding(horizontal = TranscriptMetrics.standard, vertical = TranscriptMetrics.bubbleVertical),
)
}
diff --git a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/user/UserAttachmentViews.kt b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/user/UserAttachmentViews.kt
index 2ff7f0c3f..6da6ec279 100644
--- a/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/user/UserAttachmentViews.kt
+++ b/feature/transcript/src/main/kotlin/ai/opencode/feature/transcript/user/UserAttachmentViews.kt
@@ -54,7 +54,7 @@ import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@@ -189,7 +189,7 @@ internal fun PastedTextCard(id: String, text: String, summary: PastedTextSummary
for (line in summary.preview) {
Text(
line,
- style = OpenCodeTextStyles.caption2.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.caption2.copy(fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.secondaryText,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
@@ -262,7 +262,7 @@ internal fun SharedLocationCard(
}
Text(
location.coordinateText + (location.accuracyText?.let { " · $it" } ?: ""),
- style = OpenCodeTextStyles.caption2.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.caption2.copy(fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.tertiaryText,
maxLines = 1,
)
diff --git a/feature/transcript/src/test/kotlin/ai/opencode/feature/transcript/markdown/MarkdownBlockTests.kt b/feature/transcript/src/test/kotlin/ai/opencode/feature/transcript/markdown/MarkdownBlockTests.kt
index 7aa7db0f4..123f13dd9 100644
--- a/feature/transcript/src/test/kotlin/ai/opencode/feature/transcript/markdown/MarkdownBlockTests.kt
+++ b/feature/transcript/src/test/kotlin/ai/opencode/feature/transcript/markdown/MarkdownBlockTests.kt
@@ -427,8 +427,9 @@ class MarkdownBlockTests {
assertEquals(listOf(OpenCodeTextStyles.subheadline.fontSize), paragraphCode.map { it.style.fontSize })
assertTrue(paragraphCode.all { it.style.fontWeight == null })
- // In a heading it takes the heading's size (H1 `.title2`, H2 `.title3`, H3 18, H4 `.headline`), monospaced and semibold.
- for ((level, size) in listOf(1 to 22f, 2 to 20f, 3 to 18f, 4 to 17f)) {
+ // In a heading it takes the heading's size, monospaced and semibold. Android diverges from
+ // iOS on purpose: headings are the desktop's scale (H1 19, H2 17, H3 and deeper 15).
+ for ((level, size) in listOf(1 to 19f, 2 to 17f, 3 to 15f, 4 to 15f)) {
assertEquals(size.sp, style.headingStyle(level).fontSize)
val codeRuns = codeSpans(present(heading.text, style, headingLevel = level))
assertEquals(1, codeRuns.size)
@@ -440,10 +441,10 @@ class MarkdownBlockTests {
assertEquals(standardColors.strongText, run.color)
}
- // Inline math inside H3 uses the 18 pt H3 point size (not 17 pt headline).
- assertEquals(18f, style.headingSize(3))
- assertEquals(InlineMath.fontSize(18f), InlineMath.fontSize(style.headingSize(3)))
- assertTrue(InlineMath.fontSize(style.headingSize(3)) > InlineMath.fontSize(17f))
+ // Inline math inside H3 uses the 15 sp H3 point size (not the 14 sp subheadline).
+ assertEquals(15f, style.headingSize(3))
+ assertEquals(InlineMath.fontSize(15f), InlineMath.fontSize(style.headingSize(3)))
+ assertTrue(InlineMath.fontSize(style.headingSize(3)) > InlineMath.fontSize(14f))
}
@Test fun filePathInlineCodeKeepsItsBackgroundPillAndLink() {
@@ -487,16 +488,18 @@ class MarkdownBlockTests {
}
@Test fun refinedStandardTypographyDefaultsAndIncreaseContrast() {
+ // Android diverges from iOS on purpose: transcript type follows the OpenCode desktop
+ // (15 sp body, H1/H2/H3 19/17/15, 14 sp Used N, 13 sp mono code). Tone, leading and gaps are iOS's.
with(TranscriptTunables.Knobs) {
- assertEquals(17f, bodySize.defaultValue)
+ assertEquals(15f, bodySize.defaultValue)
assertEquals(4.5f, bodyLeading.defaultValue)
assertEquals(0.92, bodyTone.defaultValue, 0.0)
- assertEquals(22f, h1Size.defaultValue)
- assertEquals(20f, h2Size.defaultValue)
- assertEquals(18f, h3Size.defaultValue)
+ assertEquals(19f, h1Size.defaultValue)
+ assertEquals(17f, h2Size.defaultValue)
+ assertEquals(15f, h3Size.defaultValue)
assertEquals(TranscriptFontWeight.Bold, h3Weight.defaultValue)
- // Per Kit's note on D-52 option 2, Used N and Working stay at 17 pt body size.
- assertEquals(17f, metaSize.defaultValue)
+ // Used N and Working sit a step under the body, like the desktop's 13 px tool titles.
+ assertEquals(14f, metaSize.defaultValue)
assertEquals(13f, listNumSize.defaultValue)
assertEquals(3f, codeLeading.defaultValue)
assertEquals(0f, paragraphGap.defaultValue)
@@ -504,18 +507,19 @@ class MarkdownBlockTests {
}
val standard = markdownStyle(standardColors)
- assertEquals(17.sp, standard.bodyStyle.fontSize)
- // `.body`'s 22 pt line plus 4.5 pt leading.
- assertEquals((22f + 4.5f).sp, standard.bodyStyle.lineHeight)
- assertEquals((20f + 3f).sp, MarkdownStyle.codeTextStyle(standard.tuning.codeLeading).lineHeight)
+ assertEquals(15.sp, standard.bodyStyle.fontSize)
+ // `.body`'s proportional 15 sp line plus 4.5 sp leading.
+ assertEquals((15f * 22f / 17f + 4.5f).sp, standard.bodyStyle.lineHeight)
+ // Code is `.footnote` (13/18) mono plus 3 sp leading.
+ assertEquals((18f + 3f).sp, MarkdownStyle.codeTextStyle(standard.tuning.codeLeading).lineHeight)
assertEquals(standardColors.bodyText(0.92), standard.bodyColor)
- assertEquals(22.sp, standard.headingStyle(1).fontSize)
- assertEquals(FontWeight.Bold, standard.headingStyle(1).fontWeight)
- assertEquals(20.sp, standard.headingStyle(2).fontSize)
+ assertEquals(19.sp, standard.headingStyle(1).fontSize)
+ assertEquals(FontWeight.SemiBold, standard.headingStyle(1).fontWeight)
+ assertEquals(17.sp, standard.headingStyle(2).fontSize)
assertEquals(FontWeight.SemiBold, standard.headingStyle(2).fontWeight)
- assertEquals(18.sp, standard.headingStyle(3).fontSize)
+ assertEquals(15.sp, standard.headingStyle(3).fontSize)
assertEquals(FontWeight.Bold, standard.headingStyle(3).fontWeight)
- assertEquals(17.sp, standard.headingStyle(4).fontSize)
+ assertEquals(15.sp, standard.headingStyle(4).fontSize)
assertEquals(FontWeight.SemiBold, standard.headingStyle(4).fontWeight)
assertEquals(13.sp, standard.listNumberStyle.fontSize)
assertEquals("tnum", standard.listNumberStyle.fontFeatureSettings)
@@ -542,7 +546,8 @@ class MarkdownBlockTests {
val tuned = MarkdownStyle(TranscriptLayoutTuning(listNumSize = 14f, codeLeading = 0f), standardColors)
assertEquals(14.sp, tuned.listNumberStyle.fontSize)
assertEquals("tnum", tuned.listNumberStyle.fontFeatureSettings)
- assertEquals(OpenCodeTextStyles.subheadline.lineHeight, MarkdownStyle.codeTextStyle(tuned.tuning.codeLeading).lineHeight)
+ // Code is `.footnote` mono on Android (the desktop's 13 px), so zero leading is footnote's line.
+ assertEquals(OpenCodeTextStyles.footnote.lineHeight, MarkdownStyle.codeTextStyle(tuned.tuning.codeLeading).lineHeight)
}
@Test fun quotesAndTablesKeepMainColourPolicyAcrossContrastModes() {
diff --git a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/FloatingCall.kt b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/FloatingCall.kt
index 9dab949b9..f9ac8f7ce 100644
--- a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/FloatingCall.kt
+++ b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/FloatingCall.kt
@@ -14,6 +14,7 @@ import ai.opencode.core.tuning.TuningPreset
import ai.opencode.core.tuning.TuningPresets
import ai.opencode.core.tuning.TuningStore
import ai.opencode.core.ui.OpenCodeIcon
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.ui.OpenCodeTextStyles
import ai.opencode.core.ui.OpenCodeTheme
import ai.opencode.core.ui.SFSymbol
@@ -31,6 +32,7 @@ import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.background
+import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
@@ -56,7 +58,6 @@ import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
@@ -74,10 +75,15 @@ import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
+import androidx.compose.ui.draw.dropShadow
+import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.shadow.Shadow
+import androidx.compose.ui.graphics.drawOutline
+import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.TransformOrigin
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.PointerInputScope
@@ -114,6 +120,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.IntOffset
+import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import java.util.Locale
import kotlinx.coroutines.CoroutineScope
@@ -1217,17 +1224,27 @@ private fun FloatingCallSurface(store: VoiceStoreOf, screen: Size, safeArea: Flo
shaping -> Modifier.pointerInput(model, "shape") { with(model) { shapeDrag() } }
else -> Modifier.pointerInput(model, "orb") { with(model) { orbDrag() } }
}
+ // The grown card's soft shadow, all round (the elevation shadow barely reaches its top edge).
+ val cardShadow = if (shaping) geometry.cardness(frame) * (1 - buttonLook) else 0.0
+ val cardShadowColor = Color.Black.copy(alpha = (if (OpenCodeTheme.colors.isDark) 0.5f else 0.1f) * cardShadow.toFloat() * alpha)
+ val cardBorder = VoiceCallSurfaceDefaults.cardBorder
Box(
Modifier
.placed(frame.left, frame.top, frame.width, frame.height)
.onPlaced { model.shapeCoordinates = it }
+ .dropShadow(shape, Shadow(radius = 20.dp, color = cardShadowColor, offset = DpOffset(0.dp, 3.dp)))
.graphicsLayer {
this.alpha = alpha
this.shape = shape
clip = true
shadowElevation = max(0.0, shadow).toFloat().dp.toPx()
}
- .background(VoiceCallSurfaceDefaults.color)
+ .background(VoiceCallSurfaceDefaults.card)
+ .drawWithContent {
+ drawContent()
+ val edge = cardBorder.copy(alpha = cardBorder.alpha * (1 - buttonLook).toFloat())
+ drawOutline(shape.createOutline(size, layoutDirection, this), edge, style = Stroke(1.dp.toPx()))
+ }
.then(gestures),
) {
FloatingCallStack(Modifier.fillMaxSize()) {
@@ -1247,7 +1264,7 @@ private fun FloatingCallSurface(store: VoiceStoreOf, screen: Size, safeArea: Flo
Box(
Modifier
.placed(0f, 0f, frame.width, frame.height)
- .background(MaterialTheme.colorScheme.surfaceContainer.copy(alpha = backing.toFloat().coerceIn(0f, 1f))),
+ .background(VoiceCallSurfaceDefaults.card.copy(alpha = backing.toFloat().coerceIn(0f, 1f))),
)
}
@@ -1375,7 +1392,7 @@ private fun FloatingCallSurface(store: VoiceStoreOf, screen: Size, safeArea: Flo
null,
Modifier.graphicsLayer { rotationZ = Math.toDegrees(connect.glyphAngle).toFloat() },
size = 20.dp,
- tint = MaterialTheme.colorScheme.background,
+ tint = OpenCodeTheme.colors.canvas,
)
}
}
@@ -1488,7 +1505,8 @@ private fun FloatingCallOrbControls(isMuted: Boolean, statusText: String, reduce
Box(
Modifier
.size(20.dp)
- .background(MaterialTheme.colorScheme.surfaceContainerHighest, CircleShape),
+ .background(VoiceCallSurfaceDefaults.controlFill, CircleShape)
+ .border(1.dp, VoiceCallSurfaceDefaults.controlBorder, CircleShape),
contentAlignment = Alignment.Center,
) {
OpenCodeIcon(SFSymbol.MicSlashFill, null, size = 12.dp, tint = OpenCodeTheme.colors.text)
@@ -1525,6 +1543,7 @@ private fun FloatingCallTag(text: String) {
Modifier
.height(36.dp)
.background(VoiceCallSurfaceDefaults.color, CircleShape)
+ .border(1.dp, VoiceCallSurfaceDefaults.border, CircleShape)
.padding(horizontal = 14.dp)
.clearAndSetSemantics {},
contentAlignment = Alignment.Center,
@@ -1554,13 +1573,19 @@ internal fun RowScope.FloatingCallControl(
// Mute turning on, or every control dimming as the call ends, eases rather than flipping.
val dim by animateFloatAsState(if (isPlaceholder || !isEnabled) 0.35f else 1f, Motion.easeOut(0.18), label = "floatingCallControlDim")
val text = OpenCodeTheme.colors.text
- val background = MaterialTheme.colorScheme.background
+ val background = OpenCodeTheme.colors.canvas
val fill by animateColorAsState(
- if (isDestructive) VoiceCallSurfaceDefaults.red else if (isOn) text else VoiceCallSurfaceDefaults.tertiaryFill,
+ if (isDestructive) VoiceCallSurfaceDefaults.red else if (isOn) text else VoiceCallSurfaceDefaults.controlFill,
Motion.easeOut(0.18),
label = "floatingCallControlFill",
)
+ val edge by animateColorAsState(
+ if (isDestructive || isOn) Color.Transparent else VoiceCallSurfaceDefaults.controlBorder,
+ Motion.easeOut(0.18),
+ label = "floatingCallControlEdge",
+ )
val tint = if (isDestructive) Color.White else if (isOn) background else text
+ val shape = RoundedCornerShape(OpenCodeRadius.panel)
Box(
Modifier
.weight(1f)
@@ -1573,15 +1598,19 @@ internal fun RowScope.FloatingCallControl(
},
contentAlignment = Alignment.Center,
) {
+ // iOS dims the whole control; here the glyph takes iOS's dim and the plate only part of
+ // it, so a control that isn't available still reads as a button on the light card.
+ val plateDim = 1f - (1f - dim) * 0.4f
Box(
Modifier
.size(diameter.dp)
- .alpha(dim)
- .background(fill, CircleShape),
+ .alpha(plateDim)
+ .background(fill, shape)
+ .border(1.dp, edge, shape),
contentAlignment = Alignment.Center,
) {
Crossfade(symbol, animationSpec = Motion.easeOut(0.18), label = "floatingCallControlGlyph") { shown ->
- OpenCodeIcon(shown, null, tint = tint, size = (diameter * 0.38f + 4).dp)
+ OpenCodeIcon(shown, null, tint = tint.copy(alpha = tint.alpha * dim / plateDim), size = (diameter * 0.38f + 4).dp)
}
}
}
diff --git a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceCallLogView.kt b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceCallLogView.kt
index a85c9f985..f6e7a45ba 100644
--- a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceCallLogView.kt
+++ b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceCallLogView.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.voice
+import ai.opencode.core.ui.OpenCodeTopBar
+import ai.opencode.core.ui.OpenCodeTopBarBackButton
import ai.opencode.core.ui.appFormattingLocale
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
@@ -44,8 +46,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.AlertDialog
-import androidx.compose.material3.CenterAlignedTopAppBar
+import ai.opencode.core.ui.OpenCodeAlertDialog
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -58,7 +59,6 @@ import androidx.compose.material3.SwipeToDismissBox
import androidx.compose.material3.SwipeToDismissBoxValue
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
-import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.rememberSwipeToDismissBoxState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -86,7 +86,7 @@ import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.text.drawText
-import androidx.compose.ui.text.font.FontFamily
+import ai.opencode.core.ui.OpenCodeFonts
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.rememberTextMeasurer
import androidx.compose.ui.text.style.TextAlign
@@ -138,11 +138,10 @@ fun VoiceCallLogList(
Scaffold(
modifier = modifier,
topBar = {
- CenterAlignedTopAppBar(
- title = { Text("History", style = OpenCodeTextStyles.headline, modifier = Modifier.semantics { heading() }) },
- navigationIcon = {
- IconButton(onClick = onBack) { OpenCodeIcon(SFSymbol.ChevronBackward, contentDescription = "Back") }
- },
+ OpenCodeTopBar(
+ title = { Text("History", modifier = Modifier.semantics { heading() }) },
+ navigation = { OpenCodeTopBarBackButton(onClick = onBack) },
+ centerTitle = true,
actions = {
if (developerMode || logs.isNotEmpty()) {
Box {
@@ -177,7 +176,6 @@ fun VoiceCallLogList(
}
}
},
- colors = TopAppBarDefaults.topAppBarColors(containerColor = MaterialTheme.colorScheme.surface),
)
},
) { padding ->
@@ -217,7 +215,7 @@ fun VoiceCallLogList(
}
if (confirmingDeleteAll) {
- AlertDialog(
+ OpenCodeAlertDialog(
onDismissRequest = { confirmingDeleteAll = false },
title = { Text("Delete all voice calls?") },
confirmButton = {
@@ -313,12 +311,10 @@ fun VoiceCallReplayView(log: VoiceCallLog, onBack: () -> Unit, modifier: Modifie
Scaffold(
modifier = modifier,
topBar = {
- CenterAlignedTopAppBar(
- title = { Text(log.title, style = OpenCodeTextStyles.headline, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.semantics { heading() }) },
- navigationIcon = {
- IconButton(onClick = onBack) { OpenCodeIcon(SFSymbol.ChevronBackward, contentDescription = "Back") }
- },
- colors = TopAppBarDefaults.topAppBarColors(containerColor = MaterialTheme.colorScheme.surface),
+ OpenCodeTopBar(
+ title = { Text(log.title, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.semantics { heading() }) },
+ navigation = { OpenCodeTopBarBackButton(onClick = onBack) },
+ centerTitle = true,
)
},
) { padding ->
@@ -612,7 +608,7 @@ private fun ReplayEvents(log: VoiceCallLog, playback: VoiceCallReplayPlayback, r
Box(Modifier.width(3.dp).fillMaxHeight().background(event.color))
Text(
event.text,
- style = OpenCodeTextStyles.caption1.copy(fontFamily = FontFamily.Monospace),
+ style = OpenCodeTextStyles.caption1.copy(fontFamily = OpenCodeFonts.monospace),
color = OpenCodeTheme.colors.text,
modifier = Modifier.padding(8.dp),
)
diff --git a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceCallRows.kt b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceCallRows.kt
index 3ea98acff..f8a0ec2f8 100644
--- a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceCallRows.kt
+++ b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceCallRows.kt
@@ -1,5 +1,7 @@
package ai.opencode.feature.voice
+import ai.opencode.core.ui.OpenCodeShape
+import ai.opencode.core.ui.OpenCodeSurfaces
import ai.opencode.core.motion.Motion
import ai.opencode.core.ui.OpenCodeIcon
import ai.opencode.core.ui.OpenCodeIconButton
@@ -102,7 +104,9 @@ fun VoiceCallRowsCard(store: VoiceStoreOf?, hidden: Boolean, reduceMotion: Boole
AnimatedVisibility(visible = !live.isEmpty, modifier = modifier, enter = enter, exit = exit) {
Surface(
shape = MaterialTheme.shapes.large,
- color = MaterialTheme.colorScheme.surfaceContainerHigh,
+ // The desktop card: floating fill, hairline ring.
+ color = OpenCodeSurfaces.color,
+ border = OpenCodeSurfaces.border,
modifier = Modifier.fillMaxWidth(),
) {
Column {
@@ -163,6 +167,7 @@ private fun ScreenRequestRow(request: ClientToolCall, send: (VoiceFeature.Action
Button(
onClick = { send(VoiceFeature.Action.ScreenRequest(VoiceScreenRequestFeature.Action.ShareTapped)) },
modifier = Modifier.semantics { testTag = "voice-screen-request-share" },
+ shape = OpenCodeShape.control,
) { Text("Share") }
}
}
@@ -192,6 +197,7 @@ private fun OpenLinkRow(request: ClientToolCall, send: (VoiceFeature.Action) ->
Button(
onClick = { send(VoiceFeature.Action.OpenLink(VoiceOpenLinkFeature.Action.OpenTapped)) },
modifier = Modifier.semantics { testTag = "voice-open-link-open" },
+ shape = OpenCodeShape.control,
) { Text("Open") }
}
}
diff --git a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceProviderViews.kt b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceProviderViews.kt
index 56f3adcee..deb552397 100644
--- a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceProviderViews.kt
+++ b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceProviderViews.kt
@@ -219,7 +219,7 @@ fun VoiceProviderFailureCard(
Column(
modifier
.fillMaxWidth()
- .callSurface(shape, VoiceCallSurfaceDefaults.color)
+ .callSurface(shape, VoiceCallSurfaceDefaults.color, VoiceCallSurfaceDefaults.border)
.padding(14.dp),
verticalArrangement = Arrangement.spacedBy(14.dp),
) {
diff --git a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceView.kt b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceView.kt
index 4cee15b74..a9bf8cecf 100644
--- a/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceView.kt
+++ b/feature/voice/src/main/kotlin/ai/opencode/feature/voice/VoiceView.kt
@@ -1,8 +1,10 @@
package ai.opencode.feature.voice
+import ai.opencode.core.ui.OpenCodeRadius
import ai.opencode.core.motion.transitionBlurEffect
import ai.opencode.core.ui.excludedFromDrawerPan
+import ai.opencode.core.ui.floating
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import ai.opencode.core.dependencies.DateClient
@@ -67,6 +69,9 @@ import androidx.compose.ui.geometry.Size
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.drawscope.Stroke
+import androidx.compose.ui.graphics.isSpecified
+import androidx.compose.ui.graphics.lerp as lerpColor
import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.Outline
import androidx.compose.ui.graphics.Path
@@ -134,8 +139,8 @@ object ComposerMetrics {
/** `composer.size.barHeight`. */
const val barHeight = 56f
- /** `composer.size.cornerRadius`. */
- const val cornerRadius = 28f
+ /** `composer.size.cornerRadius`; on this branch the desktop dock's 12. */
+ const val cornerRadius = 12f
/** `composer.spacing.innerHorizontal`. */
const val innerHorizontal = 6f
@@ -146,9 +151,40 @@ object ComposerMetrics {
* imitation.
*/
object VoiceCallSurfaceDefaults {
- /** The composer capsule and the call's cards. */
+ /**
+ * The composer and the call's cards: the desktop dock's raised surface
+ * (`--surface-raised-stronger-non-alpha`, white in light, a step above the canvas in dark).
+ */
val color: Color
- @Composable @ReadOnlyComposable get() = MaterialTheme.colorScheme.surfaceContainerHigh
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.floating
+
+ /** The dock's hairline ring (`--v2-border-border-base`). */
+ val border: Color
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.border
+
+ /**
+ * The floating call's card and sheet: one step off the page in both modes (`#F3F3F3` on the
+ * light canvas, `#252525` on the dark), so the card reads as its own surface with its hairline
+ * and shadow. Mixed from the theme's canvas and text, so curated themes and Material You follow.
+ */
+ val card: Color
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.let { lerpColor(it.canvas, it.text, if (it.isDark) 0.07f else 0.05f) }
+
+ /** The card's hairline, a little stronger than [border] so it holds on the tinted card. */
+ val cardBorder: Color
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.let {
+ if (it.strongBorders) it.variant.borderStrong.color else lerpColor(it.canvas, it.text, if (it.isDark) 0.15f else 0.13f)
+ }
+
+ /** The card's controls: raised over the card (white in light, a step up in dark), worn with [controlBorder]. */
+ val controlFill: Color
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.let { if (it.isDark) lerpColor(it.canvas, it.text, 0.13f) else it.canvas }
+
+ /** The controls' hairline. */
+ val controlBorder: Color
+ @Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.let {
+ if (it.strongBorders) it.variant.borderStrong.color else lerpColor(it.canvas, it.text, if (it.isDark) 0.22f else 0.18f)
+ }
/** `UIColor.tertiarySystemFill`: Mute's soft disc. */
val tertiaryFill: Color
@@ -165,20 +201,29 @@ object VoiceCallSurfaceDefaults {
@Composable @ReadOnlyComposable get() = OpenCodeTheme.colors.destructive
}
-/** A call surface: tonal fill with a soft shadow (iOS `openCodeGlass(in:)`). */
-fun Modifier.callSurface(shape: Shape, color: Color): Modifier = graphicsLayer {
+/**
+ * A call surface: the desktop dock's flat fill, a hairline [border] and a small raised shadow
+ * (`--v2-elevation-raised`), instead of iOS glass.
+ */
+fun Modifier.callSurface(shape: Shape, color: Color, border: Color = Color.Unspecified): Modifier = graphicsLayer {
this.shape = shape
- shadowElevation = 3.dp.toPx()
+ shadowElevation = 1.5.dp.toPx()
clip = false
-}.background(color, shape)
+}.drawBehind {
+ val outline = shape.createOutline(size, layoutDirection, this)
+ drawOutline(outline, color)
+ if (border.isSpecified) drawOutline(outline, border, style = Stroke(1.dp.toPx()))
+}
/** Animated geometry is observed by the layer/draw scopes, never by composition. */
-private fun Modifier.callSurface(shape: () -> Shape, color: Color): Modifier = graphicsLayer {
+private fun Modifier.callSurface(shape: () -> Shape, color: Color, border: Color = Color.Unspecified): Modifier = graphicsLayer {
this.shape = shape()
- shadowElevation = 3.dp.toPx()
+ shadowElevation = 1.5.dp.toPx()
clip = false
}.drawBehind {
- drawOutline(shape().createOutline(size, layoutDirection, this), color)
+ val outline = shape().createOutline(size, layoutDirection, this)
+ drawOutline(outline, color)
+ if (border.isSpecified) drawOutline(outline, border, style = Stroke(1.dp.toPx()))
}
/** Touches on this element and its children are dropped (iOS `.allowsHitTesting(false)` over content that shouldn't act). */
@@ -413,6 +458,7 @@ fun ComposerSurface(
label = "expansionDim",
)
val surfaceColor = VoiceCallSurfaceDefaults.color
+ val surfaceBorder = VoiceCallSurfaceDefaults.border
val cornerRadius = ComposerMetrics.cornerRadius
val showsExpansion = activeExpansion?.isShown == true || (activeExpansion != null && expansionReach > 0)
val glassFullAlpha by animateFloatAsState(if (surfaceExpanded) 1f else 0f, Motion.reducedFadeSpec(), label = "surfaceFull")
@@ -441,11 +487,11 @@ fun ComposerSurface(
Modifier
.fillMaxSize()
.graphicsLayer { alpha = 1f - glassFullAlpha }
- .callSurface({ TopInsetRect(extent(), cornerRadius) }, surfaceColor),
+ .callSurface({ TopInsetRect(extent(), cornerRadius) }, surfaceColor, surfaceBorder),
)
- Box(Modifier.fillMaxSize().graphicsLayer { alpha = glassFullAlpha }.callSurface(RoundedCornerShape(cornerRadius.dp), surfaceColor))
+ Box(Modifier.fillMaxSize().graphicsLayer { alpha = glassFullAlpha }.callSurface(RoundedCornerShape(cornerRadius.dp), surfaceColor, surfaceBorder))
} else {
- Box(Modifier.fillMaxSize().callSurface({ TopInsetRect(unrevealed(), cornerRadius) }, surfaceColor))
+ Box(Modifier.fillMaxSize().callSurface({ TopInsetRect(unrevealed(), cornerRadius) }, surfaceColor, surfaceBorder))
}
}
Box(
@@ -476,7 +522,7 @@ fun ComposerSurface(
Box(
Modifier
.layoutId(SurfaceSlot.expansion)
- .clip(RoundedCornerShape(28.dp))
+ .clip(RoundedCornerShape(ComposerMetrics.cornerRadius.dp))
.drawWithContent {
// Records the reach as each frame of its animation draws.
val drawn = activeExpansion.drawn
@@ -683,11 +729,11 @@ private fun ViewThatFitsHorizontally(modifier: Modifier = Modifier, wide: @Compo
*/
@Composable
fun VoiceCallEnded(store: VoiceStoreOf, modifier: Modifier = Modifier) {
- val shape = RoundedCornerShape(28.dp)
+ val shape = RoundedCornerShape(ComposerMetrics.cornerRadius.dp)
Box(
modifier
.fillMaxWidth()
- .callSurface(shape, VoiceCallSurfaceDefaults.color)
+ .callSurface(shape, VoiceCallSurfaceDefaults.color, VoiceCallSurfaceDefaults.border)
.padding(start = 18.dp, end = 8.dp, top = 6.dp, bottom = 6.dp),
) {
val title = @Composable { Text("Call Ended", style = OpenCodeTextStyles.subheadline.copy(fontWeight = FontWeight.SemiBold)) }
@@ -739,11 +785,11 @@ fun VoiceCallFailure(store: VoiceStoreOf, message: String, modifier: Modifier =
@Composable
private fun VoiceCallFailurePlainCard(store: VoiceStoreOf, message: String, modifier: Modifier) {
val isMicrophoneDenied = message == VoiceAudioError.microphoneDenied.message
- val shape = RoundedCornerShape(22.dp)
+ val shape = RoundedCornerShape(OpenCodeRadius.card)
Column(
modifier
.fillMaxWidth()
- .callSurface(shape, VoiceCallSurfaceDefaults.color)
+ .callSurface(shape, VoiceCallSurfaceDefaults.color, VoiceCallSurfaceDefaults.border)
.padding(14.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {