1package com.peachpasswords.ui.theme23import androidx.compose.foundation.layout.Box4import androidx.compose.foundation.layout.BoxScope5import androidx.compose.foundation.layout.fillMaxHeight6import androidx.compose.foundation.layout.fillMaxSize7import androidx.compose.foundation.layout.fillMaxWidth8import androidx.compose.foundation.layout.widthIn9import androidx.compose.runtime.Composable10import androidx.compose.ui.Alignment11import androidx.compose.ui.Modifier12import androidx.compose.ui.draw.drawBehind13import androidx.compose.ui.geometry.Offset14import androidx.compose.ui.geometry.Size15import androidx.compose.ui.graphics.Brush16import androidx.compose.ui.graphics.Color17import androidx.compose.ui.unit.dp18import androidx.compose.ui.graphics.drawscope.DrawScope19import androidx.compose.ui.graphics.drawscope.withTransform20import kotlin.math.abs21import kotlin.math.max222324252627282930313233343536@Composable37fun ShellBackground(38 modifier: Modifier = Modifier,39 content: @Composable BoxScope.() -> Unit,40) {41 val accent = LocalPeachAccent.current42 val base = MaterialTheme_background()43 Box(44 modifier = modifier45 .fillMaxSize()46 .drawBehind {47 drawRect(color = base)4849 drawBloom(50 center = Offset(0f, 0f),51 radiusX = size.width * 1.2f,52 radiusY = size.height * 0.8f,53 color = accent.copy(alpha = 0.08f),54 transparentAt = 0.65f,55 )56 drawBloom(57 center = Offset(size.width, size.height),58 radiusX = size.width * 0.85f,59 radiusY = size.height * 1.0f,60 color = accent.copy(alpha = 0.06f),61 transparentAt = 0.70f,62 )63 },64 content = content,65 )66}67686970717273val CONTENT_MAX_WIDTH = 480.dp74757677787980private fun DrawScope.drawBloom(81 center: Offset,82 radiusX: Float,83 radiusY: Float,84 color: Color,85 transparentAt: Float,86) {87 val r = max(radiusX, radiusY)88 val sx = radiusX / r89 val sy = radiusY / r90 withTransform({ scale(sx, sy, pivot = center) }) {91 92 93 val left = center.x + (0f - center.x) / sx94 val right = center.x + (size.width - center.x) / sx95 val top = center.y + (0f - center.y) / sy96 val bottom = center.y + (size.height - center.y) / sy97 drawRect(98 brush = Brush.radialGradient(99 0f to color,100 transparentAt to Color.Transparent,101 center = center,102 radius = r,103 ),104 topLeft = Offset(minOf(left, right), minOf(top, bottom)),105 size = Size(abs(right - left), abs(bottom - top)),106 )107 }108}109110@Composable111private fun MaterialTheme_background(): Color =112 androidx.compose.material3.MaterialTheme.colorScheme.background