Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Look: the hero panel, the sheets and the diff take their colours from the tokens; the island and the camera stay black

Claude1092fb7f220d
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/DesignControls.kt b/android/app/src/main/kotlin/com/coucou/android/ui/DesignControls.kt
index bc4a8f11..9510fdfc 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/DesignControls.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/DesignControls.kt
@@ -63,7 +63,7 @@ fun CoucouSwitch(checked: Boolean, onChange: (Boolean) -> Unit, modifier: Modifi
.background(if (checked) t.online.c() else t.panel2.c())
.border(1.dp, if (checked) Color.Transparent else t.line.c(), CircleShape),
) {
- Box(Modifier.offset(x = 3.dp + knobX, y = 3.dp).size(KNOB).clip(CircleShape).background(Color.White))
+ Box(Modifier.offset(x = 3.dp + knobX, y = 3.dp).size(KNOB).clip(CircleShape).background(if (checked || t.isDark) Color.White else Color(t.textDim)))
}
}
}
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/DesignSystem.kt b/android/app/src/main/kotlin/com/coucou/android/ui/DesignSystem.kt
index ee1bbba6..f8e40404 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/DesignSystem.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/DesignSystem.kt
@@ -35,7 +35,6 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
-import com.coucou.android.core.IslandSurface
import com.coucou.android.core.MotionPolicy
import com.coucou.android.core.MotionState
import com.coucou.android.core.Radii
@@ -97,11 +96,12 @@ internal fun DrawScope.drawWash(color: Color, alpha: Float) {
/** The hero panel at the top of Home: black, hanging from the screen's top edge. */
@Composable
fun HeroPanel(modifier: Modifier = Modifier, wash: Color? = null, content: @Composable ColumnScope.() -> Unit) {
+ val t = tokens()
val shape = RoundedCornerShape(bottomStart = Radii.HERO_BOTTOM.dp, bottomEnd = Radii.HERO_BOTTOM.dp)
Column(
- modifier.fillMaxWidth().clip(shape).background(IslandSurface.HERO.c())
- .border(1.dp, Color.White.copy(alpha = 0.06f), shape)
- .then(if (wash != null) Modifier.drawBehind { drawWash(wash, 0.5f) } else Modifier),
+ modifier.fillMaxWidth().clip(shape).background(t.hero.c())
+ .border(1.dp, t.heroLine.c(), shape)
+ .then(if (wash != null) Modifier.drawBehind { drawWash(wash, t.washAlpha.toFloat()) } else Modifier),
content = content,
)
}
@@ -118,15 +118,15 @@ fun PillButton(
enabled: Boolean = true, onDark: Boolean = false, icon: (@Composable () -> Unit)? = null,
) {
val t = tokens()
- // [onDark]: on the always-black hero panel and island, whatever the theme.
+ // [onDark]: on a hero surface (the hero panel, a sheet, the island): the tokens in force there, dark on the island whatever the theme.
val bg = when {
- onDark -> if (kind == PillKind.PRIMARY) IslandSurface.TEXT else IslandSurface.BUTTON
+ onDark -> if (kind == PillKind.PRIMARY) t.heroPrimary else t.heroButton
kind == PillKind.PRIMARY -> t.primaryButton
else -> t.secondaryButton
}
val fg = when {
kind == PillKind.DANGER -> t.danger
- onDark -> if (kind == PillKind.PRIMARY) IslandSurface.ON_PRIMARY else IslandSurface.TEXT
+ onDark -> if (kind == PillKind.PRIMARY) t.heroOnPrimary else t.heroText
kind == PillKind.PRIMARY -> t.onPrimaryButton
else -> t.text
}
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/DiffSheet.kt b/android/app/src/main/kotlin/com/coucou/android/ui/DiffSheet.kt
index bbf6570f..30ddf2de 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/DiffSheet.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/DiffSheet.kt
@@ -19,25 +19,22 @@ import androidx.compose.ui.unit.dp
import com.coucou.android.R
import com.coucou.android.app.AppModel
import com.coucou.android.core.DiffState
-import com.coucou.android.core.IslandSurface
+import com.coucou.android.core.Tokens
import com.coucou.android.core.TypeScale
import com.coucou.android.link.DiffRow
/** What the file-change sheet draws a row in: the colour of its text and of the tint behind it. */
internal object DiffLook {
- val ADDED = Color(0xFF34D399)
- val REMOVED = Color(0xFFFF8D97)
-
- fun text(kind: Char): Color = when (kind) {
- '+' -> ADDED
- '-' -> REMOVED
- '@' -> Color(IslandSurface.TEXT_DIM)
- else -> Color(IslandSurface.TEXT)
+ fun text(kind: Char, t: Tokens): Color = when (kind) {
+ '+' -> Color(t.diffAdded)
+ '-' -> Color(t.diffRemoved)
+ '@' -> Color(t.heroTextDim)
+ else -> Color(t.heroText)
}
- fun tint(kind: Char): Color = when (kind) {
- '+' -> ADDED.copy(alpha = 0.12f)
- '-' -> REMOVED.copy(alpha = 0.12f)
+ fun tint(kind: Char, t: Tokens): Color = when (kind) {
+ '+' -> Color(t.diffAdded).copy(alpha = 0.12f)
+ '-' -> Color(t.diffRemoved).copy(alpha = 0.12f)
else -> Color.Transparent
}
@@ -58,8 +55,8 @@ internal object DiffLook {
fun DiffSheet(model: AppModel) {
val state = model.diffState
if (state is DiffState.Idle) return
- val white = Color(IslandSurface.TEXT)
- val dim = Color(IslandSurface.TEXT_DIM)
+ val white = Color(tokens().heroText)
+ val dim = Color(tokens().heroTextDim)
BottomSheetHost(onDismiss = { model.closeDiff() }) {
val name = when (state) {
is DiffState.Loading -> state.name
@@ -96,8 +93,9 @@ fun DiffSheet(model: AppModel) {
@Composable
private fun DiffLine(row: DiffRow) {
- val mono = TypeScale.MONO.style(DiffLook.text(row.kind))
- Row(Modifier.fillMaxWidth().background(DiffLook.tint(row.kind)).padding(horizontal = 6.dp, vertical = 1.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ val t = tokens()
+ val mono = TypeScale.MONO.style(DiffLook.text(row.kind, t))
+ Row(Modifier.fillMaxWidth().background(DiffLook.tint(row.kind, t)).padding(horizontal = 6.dp, vertical = 1.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Text(DiffLook.marker(row.kind), style = mono.copy(fontFamily = FontFamily.Monospace))
Text(row.text, Modifier.weight(1f), style = mono.copy(fontFamily = FontFamily.Monospace))
}
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/DiscoveryHint.kt b/android/app/src/main/kotlin/com/coucou/android/ui/DiscoveryHint.kt
index 2c4d6202..3f5835b6 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/DiscoveryHint.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/DiscoveryHint.kt
@@ -22,7 +22,6 @@ import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import com.coucou.android.R
import com.coucou.android.app.AppModel
-import com.coucou.android.core.IslandSurface
import com.coucou.android.core.Spacing
import com.coucou.android.core.Tokens
import com.coucou.android.core.TypeScale
@@ -51,8 +50,8 @@ fun DiscoveryHint(onPairAgain: () -> Unit, onEnterAddress: () -> Unit) {
fun AddressSheet(model: AppModel, onDismiss: () -> Unit) {
var text by remember { mutableStateOf("") }
var bad by remember { mutableStateOf(false) }
- val white = Color(IslandSurface.TEXT)
- val dim = Color(IslandSurface.TEXT_DIM)
+ val white = Color(tokens().heroText)
+ val dim = Color(tokens().heroTextDim)
BottomSheetHost(onDismiss) {
Text(stringResource(R.string.address_title), style = TypeScale.TITLE.style(white))
Text(stringResource(R.string.address_hint), Modifier.padding(top = 4.dp, bottom = 12.dp), style = TypeScale.SECONDARY.style(dim))
@@ -62,7 +61,7 @@ fun AddressSheet(model: AppModel, onDismiss: () -> Unit) {
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
colors = OutlinedTextFieldDefaults.colors(
focusedTextColor = white, unfocusedTextColor = white, cursorColor = white,
- focusedBorderColor = white, unfocusedBorderColor = Color.White.copy(alpha = 0.25f),
+ focusedBorderColor = white, unfocusedBorderColor = Color(tokens().heroText).copy(alpha = 0.25f),
),
)
if (bad) Text(stringResource(R.string.address_bad), Modifier.padding(top = 8.dp), style = TypeScale.SECONDARY.style(Color(Tokens.DARK.danger)))
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/HomePanel.kt b/android/app/src/main/kotlin/com/coucou/android/ui/HomePanel.kt
index 62ea9b8a..d9b97815 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/HomePanel.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/HomePanel.kt
@@ -33,7 +33,6 @@ import com.coucou.android.core.HistoryDays
import com.coucou.android.core.HomePanel
import com.coucou.android.core.HomeText
import com.coucou.android.core.IconKind
-import com.coucou.android.core.IslandSurface
import com.coucou.android.core.Pills
import com.coucou.android.core.SpokenLabels
import com.coucou.android.core.Spacing
@@ -87,8 +86,8 @@ fun HeroCard(
) {
val state = focus?.state ?: BotState.SLEEPING
val wash = MochiConst.STATES[state]?.color?.let(::rgbColor)
- val dim = Color(IslandSurface.TEXT_DIM)
- val white = Color(IslandSurface.TEXT)
+ val dim = Color(tokens().heroTextDim)
+ val white = Color(tokens().heroText)
HeroPanel(wash = wash) {
Column(
Modifier.windowInsetsPadding(WindowInsets.statusBars).padding(start = Spacing.INSIDE.dp, end = Spacing.INSIDE.dp, top = 12.dp, bottom = 18.dp),
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/PairingScreen.kt b/android/app/src/main/kotlin/com/coucou/android/ui/PairingScreen.kt
index 80f9b6fd..d1f37bd0 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/PairingScreen.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/PairingScreen.kt
@@ -39,7 +39,6 @@ import androidx.compose.ui.unit.dp
import com.coucou.android.R
import com.coucou.android.app.AppModel
import com.coucou.android.core.IconKind
-import com.coucou.android.core.IslandSurface
import com.coucou.android.core.Spacing
import com.coucou.android.core.Tokens
import com.coucou.android.core.TypeScale
@@ -97,8 +96,8 @@ private fun PasteSheet(model: AppModel, onDismiss: () -> Unit) {
var text by remember { mutableStateOf("") }
var bad by remember { mutableStateOf(false) }
val clipboard = LocalClipboardManager.current
- val white = Color(IslandSurface.TEXT)
- val dim = Color(IslandSurface.TEXT_DIM)
+ val white = Color(tokens().heroText)
+ val dim = Color(tokens().heroTextDim)
fun pairWith(link: String) {
if (PairingPayload.parse(link) != null) { model.pair(link); onDismiss() } else bad = true
}
@@ -111,7 +110,7 @@ private fun PasteSheet(model: AppModel, onDismiss: () -> Unit) {
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
colors = OutlinedTextFieldDefaults.colors(
focusedTextColor = white, unfocusedTextColor = white, cursorColor = white,
- focusedBorderColor = white, unfocusedBorderColor = Color.White.copy(alpha = 0.25f),
+ focusedBorderColor = white, unfocusedBorderColor = Color(tokens().heroText).copy(alpha = 0.25f),
),
)
if (bad) Text(stringResource(R.string.msg_bad_link), Modifier.padding(top = 8.dp), style = TypeScale.SECONDARY.style(Color(Tokens.DARK.danger)))
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/ScanScreen.kt b/android/app/src/main/kotlin/com/coucou/android/ui/ScanScreen.kt
index 085d1e23..ed7884d5 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/ScanScreen.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/ScanScreen.kt
@@ -45,6 +45,7 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -117,7 +118,8 @@ fun ScanScreen(onBack: () -> Unit, onText: (String) -> Boolean) {
)
val backLabel = stringResource(R.string.action_back)
- // A camera screen: black, edge to edge, with light text.
+ // A camera screen: black, edge to edge, with light text, in both themes (so the buttons on it use the dark tokens).
+ CompositionLocalProvider(LocalTokens provides Tokens.DARK) {
Column(
Modifier.fillMaxSize().background(Color(IslandSurface.BLACK)).windowInsetsPadding(WindowInsets.statusBars).padding(horizontal = Gutter),
verticalArrangement = Arrangement.spacedBy(Gap),
@@ -165,6 +167,7 @@ fun ScanScreen(onBack: () -> Unit, onText: (String) -> Boolean) {
}
}
}
+ }
}
@Composable
diff --git a/android/app/src/main/kotlin/com/coucou/android/ui/Sheets.kt b/android/app/src/main/kotlin/com/coucou/android/ui/Sheets.kt
index bb9eb2b1..7a833842 100644
--- a/android/app/src/main/kotlin/com/coucou/android/ui/Sheets.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/ui/Sheets.kt
@@ -55,7 +55,6 @@ import com.coucou.android.app.AppModel
import com.coucou.android.core.ApprovalSheetPlan
import com.coucou.android.core.HomePanel
import com.coucou.android.core.IconKind
-import com.coucou.android.core.IslandSurface
import com.coucou.android.core.MotionSpec
import com.coucou.android.core.Pills
import com.coucou.android.core.QuestionFlow
@@ -95,8 +94,8 @@ fun BottomSheetHost(onDismiss: () -> Unit, wash: Color? = null, announce: String
enter = if (reducedMotion()) fadeIn(tween(MotionSpec.REDUCED_MS)) else slideInVertically(spring(dampingRatio = 0.72f, stiffness = 400f)) { it } + fadeIn(),
) {
Column(
- Modifier.fillMaxWidth().clip(shape).background(Color(IslandSurface.PANEL)).border(1.dp, Color.White.copy(alpha = 0.08f), shape)
- .then(if (wash != null) Modifier.drawBehind { drawWash(wash, 0.45f) } else Modifier)
+ Modifier.fillMaxWidth().clip(shape).background(Color(tokens().sheet)).border(1.dp, Color(tokens().heroLine), shape)
+ .then(if (wash != null) Modifier.drawBehind { drawWash(wash, (tokens().washAlpha * 0.9).toFloat()) } else Modifier)
.pointerInput(Unit) { detectTapGestures { } }
// A large font can make the sheet taller than the screen: it scrolls, so Deny and Allow are always reachable.
.verticalScroll(rememberScrollState())
@@ -104,7 +103,7 @@ fun BottomSheetHost(onDismiss: () -> Unit, wash: Color? = null, announce: String
.semantics { if (announce != null) paneTitle = announce }
.padding(start = 20.dp, end = 20.dp, top = 10.dp, bottom = 20.dp),
content = {
- Box(Modifier.align(Alignment.CenterHorizontally).size(width = 36.dp, height = 4.dp).clip(RoundedCornerShape(2.dp)).background(Color.White.copy(alpha = 0.2f)))
+ Box(Modifier.align(Alignment.CenterHorizontally).size(width = 36.dp, height = 4.dp).clip(RoundedCornerShape(2.dp)).background(Color(tokens().heroTextDim).copy(alpha = 0.45f)))
Box(Modifier.size(14.dp))
content()
},
@@ -134,8 +133,8 @@ fun ApprovalSheet(model: AppModel, r: ApprovalRequest, onAllow: (ApprovalRequest
var armed by remember(r.fingerprint) { mutableStateOf(false) }
LaunchedEffect(r.fingerprint) { delay(ApprovalSheetPlan.GUARD_MS); armed = true }
var showCommand by remember(r.fingerprint) { mutableStateOf(false) }
- val white = Color(IslandSurface.TEXT)
- val dim = Color(IslandSurface.TEXT_DIM)
+ val white = Color(tokens().heroText)
+ val dim = Color(tokens().heroTextDim)
val wash = MochiConst.STATES[BotState.APPROVAL]?.color?.let(::rgbColor)
val name = model.agentName(r.pillId)
val kind = Pills.byId(r.pillId)?.name.orEmpty()
@@ -156,7 +155,7 @@ fun ApprovalSheet(model: AppModel, r: ApprovalRequest, onAllow: (ApprovalRequest
)
if (showCommand) {
Column(
- Modifier.fillMaxWidth().clip(RoundedCornerShape(12.dp)).background(Color.White.copy(alpha = 0.07f)).padding(12.dp),
+ Modifier.fillMaxWidth().clip(RoundedCornerShape(12.dp)).background(Color(tokens().heroFill)).padding(12.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
Text(r.tool, style = TypeScale.LABEL.style(dim), maxLines = 1)
@@ -178,7 +177,7 @@ fun ApprovalSheet(model: AppModel, r: ApprovalRequest, onAllow: (ApprovalRequest
if (canAllow) {
PillButton(
stringResource(R.string.action_allow), { onAllow(r) }, Modifier.weight(1f), PillKind.PRIMARY, enabled = armed, onDark = true,
- icon = { CoucouIcon(IconKind.LOCK, tint = Color(IslandSurface.ON_PRIMARY), size = 18.dp) },
+ icon = { CoucouIcon(IconKind.LOCK, tint = Color(tokens().heroOnPrimary), size = 18.dp) },
)
}
}
@@ -198,8 +197,8 @@ fun ApprovalSheet(model: AppModel, r: ApprovalRequest, onAllow: (ApprovalRequest
*/
@Composable
fun QuestionSheet(model: AppModel, pillId: String, onDismiss: () -> Unit, onSend: (QuestionRequest, List<List<String>>) -> Unit) {
- val white = Color(IslandSurface.TEXT)
- val dim = Color(IslandSurface.TEXT_DIM)
+ val white = Color(tokens().heroText)
+ val dim = Color(tokens().heroTextDim)
val wash = MochiConst.STATES[BotState.QUESTION]?.color?.let(::rgbColor)
val request = model.questionFor(pillId)
val announce = stringResource(R.string.question_title, model.agentName(pillId))
@@ -240,7 +239,7 @@ fun QuestionSheet(model: AppModel, pillId: String, onDismiss: () -> Unit, onSend
stringResource(R.string.question_send),
{ QuestionFlow.picks(request.questions, st)?.let { onSend(request, it) } }, Modifier.weight(1f), PillKind.PRIMARY,
enabled = armed && QuestionFlow.complete(request.questions, st), onDark = true,
- icon = { CoucouIcon(IconKind.LOCK, tint = Color(IslandSurface.ON_PRIMARY), size = 18.dp) },
+ icon = { CoucouIcon(IconKind.LOCK, tint = Color(tokens().heroOnPrimary), size = 18.dp) },
)
} else {
PillButton(
@@ -261,12 +260,12 @@ fun QuestionSheet(model: AppModel, pillId: String, onDismiss: () -> Unit, onSend
/** One option: a label, its description, and a mark that it is picked. Tapping it is the only way to answer. */
@Composable
private fun OptionRow(option: AskedOption, selected: Boolean, multi: Boolean, onClick: () -> Unit) {
- val white = Color(IslandSurface.TEXT)
- val dim = Color(IslandSurface.TEXT_DIM)
+ val white = Color(tokens().heroText)
+ val dim = Color(tokens().heroTextDim)
val shape = RoundedCornerShape(16.dp)
Row(
Modifier.fillMaxWidth().heightIn(min = Spacing.MIN_TOUCH.dp).clip(shape)
- .background(Color.White.copy(alpha = if (selected) 0.16f else 0.07f))
+ .background(Color(tokens().heroText).copy(alpha = if (selected) 0.16f else 0.07f))
.border(1.dp, if (selected) white.copy(alpha = 0.7f) else Color.Transparent, shape)
.selectable(selected = selected, role = if (multi) Role.Checkbox else Role.RadioButton, onClick = onClick)
.padding(horizontal = 14.dp, vertical = 12.dp),
@@ -277,7 +276,7 @@ private fun OptionRow(option: AskedOption, selected: Boolean, multi: Boolean, on
.background(if (selected) white else Color.Transparent)
.border(1.5.dp, if (selected) white else dim, if (multi) RoundedCornerShape(6.dp) else CircleShape),
contentAlignment = Alignment.Center,
- ) { if (selected) CoucouIcon(IconKind.CHECK, tint = Color(IslandSurface.ON_PRIMARY), size = 16.dp) }
+ ) { if (selected) CoucouIcon(IconKind.CHECK, tint = Color(tokens().heroOnPrimary), size = 16.dp) }
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
Text(option.label, style = TypeScale.BODY.style(white).copy(fontWeight = FontWeight.SemiBold))
if (option.description.isNotBlank()) Text(option.description, style = TypeScale.SECONDARY.style(dim))