package com.peachpasswords.ui.settings import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.graphics.StrokeJoin import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.scale import androidx.compose.ui.graphics.vector.PathParser import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp /** * The seven settings-card glyphs — exact ports of the browser CardIcon.tsx * SVGs (viewBox 0 0 16 16, stroke 1.25, round caps/joins). Stroked in * currentColor so each card tints them with its own foreground. */ enum class StackIcon { Spark, Shield, Lock, Sync, Sun, Bubble } private val ICON_PATHS: Map> = mapOf( StackIcon.Shield to listOf( "M8 2.2 3.4 4.4v3.2c0 3 2.1 5.1 4.6 6.2 2.5-1.1 4.6-3.2 4.6-6.2V4.4L8 2.2Z", "M6.3 8.1 7.4 9.2 9.9 6.6", ), StackIcon.Lock to listOf( "M3 7h10v7H3Z", "M5.8 7V5.4a2.2 2.2 0 0 1 4.4 0V7", ), StackIcon.Sync to listOf( "M4 8a4 4 0 0 1 6.8-2.8", "M11 3.6v2.2H8.8", "M12 8a4 4 0 0 1-6.8 2.8", "M5 12.4v-2.2h2.2", ), StackIcon.Sun to listOf( "M8 5.2a2.8 2.8 0 1 0 0 5.6 2.8 2.8 0 0 0 0-5.6Z", "M8 1.8v1.3M8 12.9v1.3M1.8 8h1.3M12.9 8h1.3M3.6 3.6l.9.9M11.5 11.5l.9.9M12.4 3.6l-.9.9M4.5 11.5l-.9.9", ), StackIcon.Spark to listOf( "M8 1.8 9.2 6l4.1 1.2-4.1 1.2L8 12.6 6.8 8.4 2.7 7.2 6.8 6 8 1.8Z", "m12 11 .5 1.5L14 13l-1.5.5L12 15l-.5-1.5L10 13l1.5-.5L12 11Z", ), StackIcon.Bubble to listOf( "M3 4.2h10a1 1 0 0 1 1 1v5.6a1 1 0 0 1-1 1H6l-3.2 2V5.2a1 1 0 0 1 1-1Z", "M5.5 7h5M5.5 9.2h3.2", ), ) @Composable fun CardIcon( kind: StackIcon, color: Color, modifier: Modifier = Modifier, size: Dp = 16.dp, ) { val paths = remember(kind) { ICON_PATHS.getValue(kind).map { PathParser().parsePathString(it).toPath() } } val stroke = remember { Stroke(width = 1.25f, cap = StrokeCap.Round, join = StrokeJoin.Round) } Canvas(modifier = modifier.size(size)) { val s = this.size.minDimension / 16f scale(scaleX = s, scaleY = s, pivot = Offset.Zero) { paths.forEach { drawPath(it, color, style = stroke) } } } }