1package com.peachpasswords.ui.theme23import androidx.compose.material3.MaterialTheme4import androidx.compose.material3.darkColorScheme5import androidx.compose.runtime.Composable6import androidx.compose.runtime.CompositionLocalProvider7import androidx.compose.runtime.compositionLocalOf8import androidx.compose.runtime.staticCompositionLocalOf9import androidx.compose.ui.graphics.Color10import androidx.compose.ui.platform.LocalDensity11import androidx.compose.ui.text.TextStyle12import androidx.compose.ui.unit.Density13import androidx.compose.ui.text.font.FontStyle14import androidx.compose.ui.text.font.FontWeight15import androidx.compose.ui.unit.sp161718val LocalPeachAccent = compositionLocalOf { DEFAULT_ACCENT }192021val LocalReduceMotion = staticCompositionLocalOf { false }2223@Composable24fun PeachTheme(25 accent: Color = DEFAULT_ACCENT,26 reduceMotion: Boolean = false,27 textSize: String = "medium",28 content: @Composable () -> Unit,29) {30 31 32 33 34 35 val textScale = when (textSize) {36 "small" -> 0.92f37 "large" -> 1.08f38 else -> 1f39 }40 val baseDensity = LocalDensity.current41 val scaledDensity = if (textScale == 1f) {42 baseDensity43 } else {44 Density(baseDensity.density, baseDensity.fontScale * textScale)45 }46 val colors = darkColorScheme(47 primary = accent,48 onPrimary = PeachColors.Bg,49 secondary = PeachColors.SyncBusy,50 onSecondary = PeachColors.Bg,51 background = PeachColors.Bg,52 onBackground = PeachColors.T0,53 surface = PeachColors.S1,54 onSurface = PeachColors.T0,55 surfaceVariant = PeachColors.S2,56 onSurfaceVariant = PeachColors.T1,57 outline = PeachColors.T3,58 error = PeachColors.Breach,59 onError = PeachColors.Bg,60 )6162 val typography = androidx.compose.material3.Typography(63 bodyLarge = TextStyle(64 fontFamily = PeachType.Body,65 fontSize = 16.sp,66 fontWeight = FontWeight.Normal,67 ),68 titleLarge = TextStyle(69 fontFamily = PeachType.Display,70 fontSize = 24.sp,71 fontStyle = FontStyle.Italic,72 fontWeight = FontWeight.Light,73 ),74 labelLarge = TextStyle(75 fontFamily = PeachType.Body,76 fontSize = 12.sp,77 fontWeight = FontWeight.Medium,78 ),79 )8081 CompositionLocalProvider(82 LocalDensity provides scaledDensity,83 LocalPeachAccent provides accent,84 LocalReduceMotion provides reduceMotion,85 LocalPeachColors provides peachDark(accent),86 ) {87 MaterialTheme(colorScheme = colors, typography = typography, content = content)88 }89}