09c65844fada

polish: ShellBackground elliptical blooms with 65%/70% transparent stops per spec §6.3; bump v2.1.14

time
2026-06-08 18:33 UTC · 5 months ago
machine
koh2
agent
claude-opus-4-8
session
vault visual parity v2
parent
20881155fa5a
2 files app/build.gradle+2 −2app/src/main/java/com/peachpasswords/ui/theme/ShellBackground.kt+59 −23
app/build.gradle+2 −2
@@ -16,8 +16,8 @@1616         applicationId "com.peachpasswords"1717         minSdk 261818         targetSdk 3519-        versionCode 20101320-        versionName "2.1.13"19+        versionCode 20101420+        versionName "2.1.14"2121 2222         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"2323         vectorDrawables {

view file

app/src/main/java/com/peachpasswords/ui/theme/ShellBackground.kt+59 −23
@@ -10,15 +10,23 @@1010 import androidx.compose.ui.geometry.Size1111 import androidx.compose.ui.graphics.Brush1212 import androidx.compose.ui.graphics.Color13+import androidx.compose.ui.graphics.drawscope.DrawScope14+import androidx.compose.ui.graphics.drawscope.withTransform15+import kotlin.math.abs16+import kotlin.math.max1317 1418 /**1519  * The two-bloom shell background that sits behind every screen.1620  *17- * Mirrors the browser shell (popup.css):18- *   radial-gradient(120% 80% at 0% 0%,   accent 8%, transparent 65%)21+ * Mirrors the browser shell (spec §6.3 / popup.css):22+ *   radial-gradient(120% 80% at 0% 0%,    accent 8%, transparent 65%)1923  *   radial-gradient(85% 100% at 100% 100%, accent 6%, transparent 70%)20- * over a flat --bg fill. Compose radial gradients are circular, so each21- * bloom is sized off the dominant CSS axis to land in the same corner.24+ *   over a flat --bg fill.25+ *26+ * Both blooms are elliptical. A circular approximation drifts off on tall27+ * phones — the top-left bloom's vertical extent (0.8·h) outgrows its28+ * horizontal extent (1.2·w) once the aspect ratio passes ~1.5, so we draw a29+ * circular gradient and squash it to the CSS ellipse with a non-uniform scale.2230  */2331 @Composable2432 fun ShellBackground(@@ -33,30 +41,58 @@3341             .drawBehind {3442                 drawRect(color = base)3543 36-                // Top-left bloom — CSS 120% × 80% at 0% 0%, accent 8% → transparent @65%.37-                val topRadius = size.width * 1.2f38-                drawRect(39-                    brush = Brush.radialGradient(40-                        colors = listOf(accent.copy(alpha = 0.08f), Color.Transparent),41-                        center = Offset(0f, 0f),42-                        radius = topRadius,43-                    ),44-                    size = Size(size.width, size.height),44+                drawBloom(45+                    center = Offset(0f, 0f),46+                    radiusX = size.width * 1.2f,47+                    radiusY = size.height * 0.8f,48+                    color = accent.copy(alpha = 0.08f),49+                    transparentAt = 0.65f,4550                 )46-47-                // Bottom-right bloom — CSS 85% × 100% at 100% 100%, accent 6% → transparent @70%.48-                val bottomRadius = size.height * 1.0f49-                drawRect(50-                    brush = Brush.radialGradient(51-                        colors = listOf(accent.copy(alpha = 0.06f), Color.Transparent),52-                        center = Offset(size.width, size.height),53-                        radius = bottomRadius,54-                    ),55-                    size = Size(size.width, size.height),51+                drawBloom(52+                    center = Offset(size.width, size.height),53+                    radiusX = size.width * 0.85f,54+                    radiusY = size.height * 1.0f,55+                    color = accent.copy(alpha = 0.06f),56+                    transparentAt = 0.70f,5657                 )5758             },5859         content = content,5960     )61+}62+63+/**64+ * Draw one elliptical radial bloom. [transparentAt] is the fraction of the65+ * ellipse radius where the colour has fully faded — matching the CSS66+ * `transparent <pct>` stop so the warmth stays concentrated in its corner.67+ */68+private fun DrawScope.drawBloom(69+    center: Offset,70+    radiusX: Float,71+    radiusY: Float,72+    color: Color,73+    transparentAt: Float,74+) {75+    val r = max(radiusX, radiusY)76+    val sx = radiusX / r77+    val sy = radiusY / r78+    withTransform({ scale(sx, sy, pivot = center) }) {79+        // The screen rect, mapped back through the scale, is the area we must80+        // paint so the squashed gradient still covers every visible pixel.81+        val left = center.x + (0f - center.x) / sx82+        val right = center.x + (size.width - center.x) / sx83+        val top = center.y + (0f - center.y) / sy84+        val bottom = center.y + (size.height - center.y) / sy85+        drawRect(86+            brush = Brush.radialGradient(87+                0f to color,88+                transparentAt to Color.Transparent,89+                center = center,90+                radius = r,91+            ),92+            topLeft = Offset(minOf(left, right), minOf(top, bottom)),93+            size = Size(abs(right - left), abs(bottom - top)),94+        )95+    }6096 }6197 6298 @Composable

view file