PeachMark.kt

3.2 KB · raw

1package com.peachpasswords.ui.components23import androidx.compose.foundation.Canvas4import androidx.compose.foundation.layout.size5import androidx.compose.foundation.layout.padding6import androidx.compose.runtime.Composable7import androidx.compose.runtime.remember8import androidx.compose.ui.Modifier9import androidx.compose.ui.geometry.Offset10import androidx.compose.ui.geometry.Size11import androidx.compose.ui.graphics.Color12import androidx.compose.ui.graphics.drawscope.Stroke13import androidx.compose.ui.graphics.drawscope.rotate14import androidx.compose.ui.graphics.drawscope.scale15import androidx.compose.ui.graphics.vector.PathParser16import androidx.compose.ui.unit.Dp17import androidx.compose.ui.unit.dp1819/**20 * The Peach brand mark — a peach fruit with a single leaf. Exact port of the21 * browser PeachMark.tsx SVG (viewBox 240×240). The leaf is ALWAYS sage green22 * (#92AC65 fill, #5E7A42 vein) and the body is fixed peach tones — none of it23 * is accent-driven. [alpha] dims the whole mark for the faint lock-screen art.24 */25@Composable26fun PeachMark(27    modifier: Modifier = Modifier,28    size: Dp = 14.dp,29    alpha: Float = 1f,30) {31    val leaf = remember {  PathParser().parsePathString("M 124 64 C 134 32 168 16 200 22 C 198 56 168 72 130 66 Z").toPath() }32    val vein = remember {  PathParser().parsePathString("M 130 64 C 152 46 178 30 196 24").toPath() }33    val bodyLight = remember {  PathParser().parsePathString("M 120 60 C 75 45 28 75 22 130 C 18 185 65 222 125 222 C 185 222 222 185 220 130 C 218 78 170 45 120 60 Z").toPath() }34    val bodyShadow = remember {  PathParser().parsePathString("M 120 60 C 75 45 28 75 22 130 C 18 185 65 222 125 222 C 105 195 75 150 100 90 C 105 75 112 65 120 60 Z").toPath() }3536    Canvas(modifier = modifier.size(size)) {37        val s = this.size.minDimension / 240f38        scale(scaleX = s, scaleY = s, pivot = Offset.Zero) {39            drawPath(bodyLight, Color(0xFFFFB082), alpha = alpha)40            drawPath(bodyShadow, Color(0xFFE5805C), alpha = alpha)41            // Highlight ellipse: cx178 cy108 rx20 ry11, rotate(-26°).42            rotate(degrees = -26f, pivot = Offset(178f, 108f)) {43                drawOval(44                    color = Color(0xFFFFD0A8),45                    topLeft = Offset(178f - 20f, 108f - 11f),46                    size = Size(40f, 22f),47                    alpha = alpha * 0.7f,48                )49            }50            drawPath(leaf, Color(0xFF92AC65), alpha = alpha)51            drawPath(vein, Color(0xFF5E7A42), alpha = alpha, style = Stroke(width = 2.6f))52        }53    }54}5556/**57 * Mark + "peach" lockup, top-left on the pre-vault screens. Extracted because58 * Lock and Onboarding each hand-rolled it and drifted apart — onboarding lost59 * the mark entirely.60 */61@Composable62fun PeachWordmark(modifier: Modifier = Modifier) {63    androidx.compose.foundation.layout.Row(64        modifier = modifier,65        verticalAlignment = androidx.compose.ui.Alignment.CenterVertically,66    ) {67        PeachMark(modifier = Modifier.padding(end = com.peachpasswords.ui.theme.PeachSpacing.xs))68        androidx.compose.material3.Text(69            text = "peach",70            color = com.peachpasswords.ui.theme.LocalPeachAccent.current,71            style = com.peachpasswords.ui.theme.PeachType.wordmark,72        )73    }74}