Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

Replace Nocturne with Samosa skin; fix link and bubble contrast

Rishabh Bajpai83d44fbd1f9e
diff --git a/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt b/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt
index 0a48397..4fd0917 100644
--- a/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt
@@ -65,7 +65,9 @@ fun AppearanceScreen(
onApply: (Settings) -> Unit
) {
val initial = remember { load() }
- var skinId by remember { mutableStateOf(initial.skinId) }
+ // Resolved, not raw: a retired stored id (nocturne) still has to show its
+ // replacement's tile as selected, and saving then persists the new id.
+ var skinId by remember { mutableStateOf(Skins.byId(initial.skinId).id) }
val overlay = rememberSettingsOverlayState()
val tier = LocalGlassTier.current
diff --git a/app/src/main/java/com/gotcha/ui/CodeBox.kt b/app/src/main/java/com/gotcha/ui/CodeBox.kt
index d770808..8b3dcb7 100644
--- a/app/src/main/java/com/gotcha/ui/CodeBox.kt
+++ b/app/src/main/java/com/gotcha/ui/CodeBox.kt
@@ -21,10 +21,14 @@ import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.SpanStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.dp
import com.gotcha.R
import com.gotcha.ui.theme.GotchaMono
@@ -32,6 +36,8 @@ import com.gotcha.ui.theme.LocalSkin
import com.halilibo.richtext.markdown.Markdown
import com.halilibo.richtext.ui.RichTextStyle
import com.halilibo.richtext.ui.material3.Material3RichText
+import com.halilibo.richtext.ui.merge
+import com.halilibo.richtext.ui.string.RichTextStringStyle
/**
* Markdown with its fenced code blocks drawn as [CodeBox]es, so a command the
@@ -39,12 +45,35 @@ import com.halilibo.richtext.ui.material3.Material3RichText
*/
@Composable
fun RichMarkdown(markdown: String, modifier: Modifier = Modifier, style: RichTextStyle? = null) {
+ // The renderer's own defaults ignore the skin: links come out pure blue
+ // (1.1:1 on Orchid's violet) and inline code on a light-grey wash. Both
+ // are restated here from the skin, so every prose surface is fixed at once.
+ // A caller [style] still wins where it says anything (see merge): the
+ // release-notes heading override keeps working.
+ val skin = LocalSkin.current
+ val scheme = MaterialTheme.colorScheme
+ val skinStyle = remember(skin, scheme, style) {
+ RichTextStyle(
+ stringStyle = RichTextStringStyle(
+ linkStyle = SpanStyle(
+ color = skin.link,
+ textDecoration = TextDecoration.Underline
+ ),
+ codeStyle = SpanStyle(
+ color = scheme.onSurface,
+ background = scheme.surfaceContainerHighest,
+ fontFamily = GotchaMono,
+ fontWeight = FontWeight.Medium
+ )
+ )
+ ).merge(style)
+ }
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
splitFencedBlocks(markdown).flatMap { segment ->
if (segment is MarkdownSegment.Prose) splitTables(segment.markdown) else listOf(segment)
}.forEach { segment ->
when (segment) {
- is MarkdownSegment.Prose -> Material3RichText(style = style) { Markdown(segment.markdown) }
+ is MarkdownSegment.Prose -> Material3RichText(style = skinStyle) { Markdown(segment.markdown) }
is MarkdownSegment.Code -> CodeBox(code = segment.code, language = segment.language)
is MarkdownSegment.Table -> MarkdownTable(
headers = segment.headers,
diff --git a/app/src/main/java/com/gotcha/ui/MessageBubble.kt b/app/src/main/java/com/gotcha/ui/MessageBubble.kt
index 0d625b6..b04b0c6 100644
--- a/app/src/main/java/com/gotcha/ui/MessageBubble.kt
+++ b/app/src/main/java/com/gotcha/ui/MessageBubble.kt
@@ -122,7 +122,7 @@ fun MessageBubble(
contentColor = contentColor,
shadowElevation = if (unbubbled) 0.dp else 2.dp,
// The skin owns the shape as well as the colour: Orchid is generous,
- // Nocturne is tight, Deep Space is exactly what it always was.
+ // Samosa is a touch tighter, Deep Space is exactly what it always was.
shape = RoundedCornerShape(
topStart = skin.corner,
topEnd = skin.corner,
diff --git a/app/src/main/java/com/gotcha/ui/theme/Color.kt b/app/src/main/java/com/gotcha/ui/theme/Color.kt
index 5ae73d3..897a633 100644
--- a/app/src/main/java/com/gotcha/ui/theme/Color.kt
+++ b/app/src/main/java/com/gotcha/ui/theme/Color.kt
@@ -36,12 +36,13 @@ val DarkOnSurfaceVariant = Color(0xFFCBD5E1)
// Brand ramp
// ---------------------------------------------------------------------------
// Sampled from the launcher icon (res/mipmap-*/ic_launcher_round.png): a
-// five-stop ramp over a white field. Every skin below Deep Space is built out
-// of these five and nothing else, which is what keeps the app looking like its
-// own icon no matter which theme is on.
+// five-stop ramp over a white field. The icon skins are built out of these
+// five and nothing else, which is what keeps the app looking like its own
+// icon no matter which theme is on.
//
// Deep Space is the exception and stays cyan — it is what shipped, and it is
-// left alone so an update never repaints someone's app without asking.
+// left alone so an update never repaints someone's app without asking. Samosa
+// is the other: it follows the company mark (gold on black), not the icon.
val BrandViolet = Color(0xFF7E1F88)
val BrandMagenta = Color(0xFFC82F92)
@@ -62,6 +63,10 @@ val AuraOutline = Color(0xFF57575E)
val AuraRoseContainer = Color(0xFF4A0F2C)
val AuraOnRoseContainer = Color(0xFFFFD9E4)
+/** Links: pale rose, clears 4.5:1 on the ground, in the user bubble, and on
+ * the fog blobs behind prose (checked at full blob strength; blur only helps). */
+val AuraLink = Color(0xFFFFD0DC)
+
// ---- Vellum: the icon's own white field, turned into an interface ----
val VellumGround = Color(0xFFF1EFF2)
val VellumPanel = Color(0x9EFFFFFF)
@@ -72,6 +77,11 @@ val VellumOutline = Color(0xFF867A88)
val VellumMagentaContainer = Color(0xFFFFD8EC)
val VellumOnMagentaContainer = Color(0xFF3A0028)
+/** Links: deep plum. The magenta ink passes on paper but collapses to 2.9:1
+ * on the purple fog blob; this clears 4.5:1 on the ground, the bubble and
+ * every blob at full strength. */
+val VellumLink = Color(0xFF7A1857)
+
// ---- Orchid: one saturated violet ground, coral for every action ----
val OrchidGround = BrandViolet
val OrchidPanel = Color(0x40FFFFFF)
@@ -82,20 +92,33 @@ val OrchidOutline = Color(0xFFB878BE)
val OrchidOnCoral = Color(0xFF45061F)
val OrchidCoralContainer = Color(0xFF6E1443)
+/** Bubble ink: soft rose instead of pure white — same 8.8:1, less glare. */
+val OrchidOnCoralContainer = Color(0xFFFFD9E4)
+
+/** Links: pale peach, clears 4.5:1 on the violet ground and in the bubble. */
+val OrchidLink = Color(0xFFFFC9B8)
+
/** Dialogs and menus: deep enough that coral and the dim ink both clear 4.5:1. */
val OrchidPopup = Color(0xFF4A1052)
-// ---- Nocturne: the icon's facets at wallpaper scale, behind dark glass ----
-val NocturneGround = Color(0xFF0A050E)
-val NocturnePanel = Color(0x8F1A1020)
-val NocturnePanelHigh = Color(0x40FFFFFF)
-val NocturneInk = Color(0xFFF7EAF1)
-val NocturneInkDim = Color(0xFFD7C6E0)
-val NocturneOutline = Color(0xFF6B5478)
-val NocturneOnSalmon = Color(0xFF3D0A16)
-val NocturneSalmonContainer = Color(0xFF5C1A2A)
-val NocturneMagentaContainer = Color(0xFF3A1140)
-val NocturneOnMagentaContainer = Color(0xFFF7D9F2)
+// ---- Samosa: the company mark as an interface ----
+// Golden dark, not a sixth pink. The Samosa logo is a golden samosa
+// (#E5AA36) with a white curve on black, so the skin is warm black,
+// golden actions and warm-white ink — nothing shared with the icon ramp.
+val SamosaGround = Color(0xFF0D0A05)
+val SamosaPanel = Color(0x40FFFFFF)
+val SamosaPanelHigh = Color(0x59FFFFFF)
+val SamosaInk = Color(0xFFFFF8F0)
+val SamosaInkDim = Color(0xFFC9B79A)
+val SamosaOutline = Color(0xFF8A7360)
+val SamosaGold = Color(0xFFE5AA36)
+val SamosaOnGold = Color(0xFF2A1A00)
+val SamosaGoldContainer = Color(0xFF4A2C08)
+val SamosaOnGoldContainer = Color(0xFFFFF0DC)
+
+/** Links: light gold, clears 4.5:1 on the ground and in the user bubble. */
+val SamosaLink = Color(0xFFFFD58A)
+val SamosaSecondaryContainer = Color(0xFF3A250E)
// ---------------------------------------------------------------------------
// Container roles
@@ -130,15 +153,18 @@ val OrchidContainer = Color(0xFF7E1F88)
val OrchidContainerHigh = Color(0xFF8A2794)
val OrchidContainerHighest = Color(0xFF96309F)
-val NocturneContainerLowest = Color(0xFF07040A)
-val NocturneContainerLow = Color(0xFF0D0812)
-val NocturneContainer = Color(0xFF171021)
-val NocturneContainerHigh = Color(0xFF201729)
-val NocturneContainerHighest = Color(0xFF2A1F35)
+val SamosaContainerLowest = Color(0xFF0B0805)
+val SamosaContainerLow = Color(0xFF120D07)
+val SamosaContainer = Color(0xFF1A130A)
+val SamosaContainerHigh = Color(0xFF241B0C)
+val SamosaContainerHighest = Color(0xFF2E2314)
+
+/** Dialogs and menus: deep warm brown, so gold clears 8:1 on it. */
+val SamosaPopup = Color(0xFF1E1206)
/**
* Error red for the pink skins. The stock M3 error would sit a few degrees from
- * Aura's rose and Nocturne's salmon, and an error that looks like the send
+ * Aura's rose and Samosa's gold, and an error that looks like the send
* button is not an error — this one is pushed toward orange to stay legible as
* "something went wrong" next to an accent that is already warm.
*/
diff --git a/app/src/main/java/com/gotcha/ui/theme/Skin.kt b/app/src/main/java/com/gotcha/ui/theme/Skin.kt
index d832b9f..3aaf8cf 100644
--- a/app/src/main/java/com/gotcha/ui/theme/Skin.kt
+++ b/app/src/main/java/com/gotcha/ui/theme/Skin.kt
@@ -50,6 +50,9 @@ enum class Backdrop {
* @param popup what dialogs and menus paint, when the derived default (see
* [menuContainer]) leaves the accent or the dim ink below 4.5:1 on it.
* SkinContrastTest says when a skin needs one.
+ * @param link the colour of Markdown links on the ground and in the user
+ * bubble. The renderer defaults to pure blue, which is unreadable on every
+ * dark ground, so each skin names a link colour that clears 4.5:1 on both.
*/
data class Skin(
val id: String,
@@ -59,6 +62,7 @@ data class Skin(
val backdrop: Backdrop,
val ground: Color,
val scheme: ColorScheme,
+ val link: Color,
val wallpaper: List<Color> = emptyList(),
val frost: Dp = 0.dp,
val grain: Float = 0f,
@@ -227,7 +231,7 @@ private val OrchidScheme = darkColorScheme(
primary = BrandCoral,
onPrimary = OrchidOnCoral,
primaryContainer = OrchidCoralContainer,
- onPrimaryContainer = Color.White,
+ onPrimaryContainer = OrchidOnCoralContainer,
secondary = OrchidInkDim,
onSecondary = OrchidGround,
secondaryContainer = OrchidPanelHigh,
@@ -250,29 +254,29 @@ private val OrchidScheme = darkColorScheme(
onError = BrandOnError
)
-private val NocturneScheme = darkColorScheme(
- primary = BrandSalmon,
- onPrimary = NocturneOnSalmon,
- primaryContainer = NocturneSalmonContainer,
- onPrimaryContainer = Color.White,
- secondary = BrandMagenta,
- onSecondary = Color.White,
- secondaryContainer = NocturneMagentaContainer,
- onSecondaryContainer = NocturneOnMagentaContainer,
- tertiary = BrandViolet,
+private val SamosaScheme = darkColorScheme(
+ primary = SamosaGold,
+ onPrimary = SamosaOnGold,
+ primaryContainer = SamosaGoldContainer,
+ onPrimaryContainer = SamosaOnGoldContainer,
+ secondary = SamosaInkDim,
+ onSecondary = SamosaGround,
+ secondaryContainer = SamosaSecondaryContainer,
+ onSecondaryContainer = SamosaOnGoldContainer,
+ tertiary = Color.White,
background = Color.Transparent,
- onBackground = NocturneInk,
- surface = NocturnePanel,
- onSurface = NocturneInk,
- surfaceVariant = NocturnePanelHigh,
- onSurfaceVariant = NocturneInkDim,
- surfaceContainer = NocturneContainer,
- surfaceContainerHigh = NocturneContainerHigh,
- surfaceContainerHighest = NocturneContainerHighest,
- surfaceContainerLow = NocturneContainerLow,
- surfaceContainerLowest = NocturneContainerLowest,
- outline = NocturneOutline,
- outlineVariant = NocturneOutline,
+ onBackground = SamosaInk,
+ surface = SamosaPanel,
+ onSurface = SamosaInk,
+ surfaceVariant = SamosaPanelHigh,
+ onSurfaceVariant = SamosaInkDim,
+ surfaceContainer = SamosaContainer,
+ surfaceContainerHigh = SamosaContainerHigh,
+ surfaceContainerHighest = SamosaContainerHighest,
+ surfaceContainerLow = SamosaContainerLow,
+ surfaceContainerLowest = SamosaContainerLowest,
+ outline = SamosaOutline,
+ outlineVariant = SamosaOutline,
error = BrandError,
onError = BrandOnError
)
@@ -303,6 +307,7 @@ object Skins {
grain = 0.06f,
scrim = 0.05f,
corner = 22.dp,
+ link = AuraLink,
// The derived panel grey leaves the rose at 4.3:1; one step darker clears it.
popup = AuraContainerHigh
)
@@ -325,7 +330,8 @@ object Skins {
frost = 18.dp,
grain = 0.04f,
scrim = 0.05f,
- corner = 22.dp
+ corner = 22.dp,
+ link = VellumLink
)
/**
@@ -348,29 +354,33 @@ object Skins {
grain = 0.12f,
// The Arc read is a generous radius; it is half of why that look reads
// as soft even though the colour is shouting.
+ // White on the deep rose container passes but reads harsh — a soft rose
+ // keeps 8.8:1 and stops the bubble shouting at the prose beside it.
corner = 26.dp,
+ link = OrchidLink,
// Coral on the derived lilac panel measured 1.7:1 on a phone. Dialogs sit
// on the ramp's violet, deepened until coral clears 5:1.
popup = OrchidPopup
)
- /** The launcher icon's low-poly geometry, blown up to wallpaper scale. */
- val Nocturne = Skin(
- id = "nocturne",
- label = "Nocturne",
- tagline = "Faceted dark. The icon's shards read through black glass.",
+ /** The company mark as an interface: warm black, golden actions. */
+ val Samosa = Skin(
+ id = "samosa",
+ label = "Samosa",
+ tagline = "Golden dark. Warm black ground, golden actions.",
brightness = Brightness.DARK,
- backdrop = Backdrop.FACETS,
- ground = NocturneGround,
- scheme = NocturneScheme,
- wallpaper = listOf(BrandViolet, BrandMagenta, BrandRose, BrandCoral, BrandSalmon),
- frost = 18.dp,
- grain = 0.06f,
- // Enough veil to keep every shard behind the text rather than beside it.
- scrim = 0.18f,
- // Tighter than the rest: the wallpaper is hard edges, and round chrome
- // over it reads as two unrelated designs.
- corner = 16.dp
+ backdrop = Backdrop.FLAT,
+ ground = SamosaGround,
+ scheme = SamosaScheme,
+ link = SamosaLink,
+ frost = 8.dp,
+ grain = 0.10f,
+ // A touch tighter than Orchid: the mark is a hard-edged triangle, and
+ // round chrome over flat black reads softer than the brand is.
+ corner = 18.dp,
+ // Gold on the derived grey panel comes out at ~4.4:1, still below the
+ // bar. Dialogs sit on deep warm brown, where gold clears 8:1.
+ popup = SamosaPopup
)
/**
@@ -387,7 +397,8 @@ object Skins {
brightness = Brightness.DARK,
backdrop = Backdrop.NONE,
ground = DeepSpaceGround,
- scheme = DarkColorScheme
+ scheme = DarkColorScheme,
+ link = CyberCyan
)
val DeepSpaceLight = Skin(
@@ -397,10 +408,11 @@ object Skins {
brightness = Brightness.LIGHT,
backdrop = Backdrop.NONE,
ground = LightSurface,
- scheme = LightColorScheme
+ scheme = LightColorScheme,
+ link = LightPrimary
)
- val all = listOf(Aura, Vellum, Orchid, Nocturne, DeepSpaceDark, DeepSpaceLight)
+ val all = listOf(Aura, Vellum, Orchid, Samosa, DeepSpaceDark, DeepSpaceLight)
/**
* The skin id a fresh install lands on, and the value the theme uses when
@@ -424,5 +436,8 @@ object Skins {
*/
val OVERLAY_FALLBACK_ID: String get() = DeepSpaceDark.id
- fun byId(id: String): Skin = all.firstOrNull { it.id == id } ?: DeepSpaceDark
+ fun byId(id: String): Skin = all.firstOrNull { it.id == id }
+ // The retired faceted theme opens as Samosa: same fourth slot, same
+ // dark glass, so nobody's app repaints to the opaque fallback.
+ ?: if (id == "nocturne") Samosa else DeepSpaceDark
}
diff --git a/app/src/test/java/com/gotcha/ui/theme/OverlaySkinTest.kt b/app/src/test/java/com/gotcha/ui/theme/OverlaySkinTest.kt
index ca9c6d7..6df7729 100644
--- a/app/src/test/java/com/gotcha/ui/theme/OverlaySkinTest.kt
+++ b/app/src/test/java/com/gotcha/ui/theme/OverlaySkinTest.kt
@@ -27,10 +27,10 @@ class OverlaySkinTest {
assertEquals(Skins.Orchid.corner.value, orchid.cardRadiusDp, 0.001f)
assertEquals(Skins.Orchid.cornerSmall.value, orchid.buttonRadiusDp, 0.001f)
- val nocturne = overlaySkin(context, Skins.Nocturne.id)
+ val samosa = overlaySkin(context, Skins.Samosa.id)
assertTrue(
"the skins have different shapes, so their overlays must too",
- orchid.cardRadiusDp != nocturne.cardRadiusDp
+ orchid.cardRadiusDp != samosa.cardRadiusDp
)
}
diff --git a/app/src/test/java/com/gotcha/ui/theme/SkinContrastTest.kt b/app/src/test/java/com/gotcha/ui/theme/SkinContrastTest.kt
index 510d1f9..7919e63 100644
--- a/app/src/test/java/com/gotcha/ui/theme/SkinContrastTest.kt
+++ b/app/src/test/java/com/gotcha/ui/theme/SkinContrastTest.kt
@@ -44,6 +44,44 @@ class SkinContrastTest {
}
}
+ /**
+ * Links used to come out pure blue on every skin — 1.1:1 on Orchid's
+ * violet — because the renderer was never given a style. Each skin now
+ * names its link colour; it must clear 4.5:1 on the ground (assistant
+ * prose), in the user bubble, and on every wallpaper blob composited over
+ * the ground at full strength. The blur only softens the blobs, so full
+ * strength is the pessimistic case; flat and opaque skins have no blobs
+ * and skip that leg.
+ */
+ @Test
+ fun `links are readable on the ground, in user bubbles and on wallpaper`() {
+ allMaterials.forEach { skin ->
+ assertReadable(skin, "link on the ground", skin.link, skin.ground)
+ assertReadable(
+ skin,
+ "link in the user bubble",
+ skin.link,
+ skin.scheme.primaryContainer
+ )
+ skin.wallpaper.forEach { blob ->
+ assertReadable(
+ skin,
+ "link on wallpaper blob $blob",
+ skin.link,
+ composite(blob, skin.ground)
+ )
+ }
+ }
+ }
+
+ @Test
+ fun `the retired nocturne id opens samosa, not the fallback`() {
+ assertTrue(
+ "a stored nocturne skin must land on its replacement",
+ Skins.byId("nocturne") === Skins.Samosa
+ )
+ }
+
@Test
fun `the dialog is opaque in every skin`() {
allMaterials.forEach { skin ->
@@ -65,6 +103,17 @@ class SkinContrastTest {
return (maxOf(la, lb) + 0.05f) / (minOf(la, lb) + 0.05f)
}
+ /** Alpha-composites a translucent wallpaper blob onto the ground. */
+ private fun composite(fg: Color, bg: Color): Color {
+ if (fg.alpha >= 1f) return fg
+ return Color(
+ red = fg.red * fg.alpha + bg.red * (1f - fg.alpha),
+ green = fg.green * fg.alpha + bg.green * (1f - fg.alpha),
+ blue = fg.blue * fg.alpha + bg.blue * (1f - fg.alpha),
+ alpha = 1f
+ )
+ }
+
private companion object {
const val MIN_TEXT = 4.5f
}
diff --git a/detekt-rules/src/main/kotlin/com/gotcha/detekt/GotchaRules.kt b/detekt-rules/src/main/kotlin/com/gotcha/detekt/GotchaRules.kt
index 4cd7ee8..1556f17 100644
--- a/detekt-rules/src/main/kotlin/com/gotcha/detekt/GotchaRules.kt
+++ b/detekt-rules/src/main/kotlin/com/gotcha/detekt/GotchaRules.kt
@@ -52,7 +52,7 @@ class NoRawDebugLog(config: Config) : Rule(config) {
* and the free-form `Dialog` / `BasicAlertDialog` / `Popup` — outside the theme
* package. Material 3 1.2 paints the first three from the `surface` role, and a
* bare `Surface` inside the others defaults to it too. Every glass skin (Aura,
- * Vellum, Orchid, Nocturne) leaves that role translucent, so the screen
+ * Vellum, Orchid, Samosa) leaves that role translucent, so the screen
* underneath reads straight through the popup. `SkinAlertDialog`,
* `SkinDropdownMenu`, `SkinExposedDropdownMenu` and `SkinDialog` hand them an
* opaque container instead.