package com.peachpasswords.ui.theme import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color /** * The two-bloom shell background that sits behind every screen. * * Mirrors the browser shell (popup.css): * radial-gradient(120% 80% at 0% 0%, accent 8%, transparent 65%) * radial-gradient(85% 100% at 100% 100%, accent 6%, transparent 70%) * over a flat --bg fill. Compose radial gradients are circular, so each * bloom is sized off the dominant CSS axis to land in the same corner. */ @Composable fun ShellBackground( modifier: Modifier = Modifier, content: @Composable BoxScope.() -> Unit, ) { val accent = LocalPeachAccent.current val base = MaterialTheme_background() Box( modifier = modifier .fillMaxSize() .drawBehind { drawRect(color = base) // Top-left bloom — CSS 120% × 80% at 0% 0%, accent 8% → transparent @65%. val topRadius = size.width * 1.2f drawRect( brush = Brush.radialGradient( colors = listOf(accent.copy(alpha = 0.08f), Color.Transparent), center = Offset(0f, 0f), radius = topRadius, ), size = Size(size.width, size.height), ) // Bottom-right bloom — CSS 85% × 100% at 100% 100%, accent 6% → transparent @70%. val bottomRadius = size.height * 1.0f drawRect( brush = Brush.radialGradient( colors = listOf(accent.copy(alpha = 0.06f), Color.Transparent), center = Offset(size.width, size.height), radius = bottomRadius, ), size = Size(size.width, size.height), ) }, content = content, ) } @Composable private fun MaterialTheme_background(): Color = androidx.compose.material3.MaterialTheme.colorScheme.background