PeachTheme.kt

2.3 KB · raw

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.text.TextStyle11import androidx.compose.ui.text.font.FontStyle12import androidx.compose.ui.text.font.FontWeight13import androidx.compose.ui.unit.sp1415/** Current accent color, available to any composable under [PeachTheme]. */16val LocalPeachAccent = compositionLocalOf { DEFAULT_ACCENT }1718/** When true, decorative/long-running animations should be skipped or shortened. */19val LocalReduceMotion = staticCompositionLocalOf { false }2021@Composable22fun PeachTheme(23    accent: Color = DEFAULT_ACCENT,24    reduceMotion: Boolean = false,25    content: @Composable () -> Unit,26) {27    val colors = darkColorScheme(28        primary = accent,29        onPrimary = PeachColors.Bg,30        secondary = PeachColors.SyncBusy,31        onSecondary = PeachColors.Bg,32        background = PeachColors.Bg,33        onBackground = PeachColors.T0,34        surface = PeachColors.S1,35        onSurface = PeachColors.T0,36        surfaceVariant = PeachColors.S2,37        onSurfaceVariant = PeachColors.T1,38        outline = PeachColors.T3,39        error = PeachColors.Breach,40        onError = PeachColors.Bg,41    )4243    val typography = androidx.compose.material3.Typography(44        bodyLarge = TextStyle(45            fontFamily = PeachType.Body,46            fontSize = 16.sp,47            fontWeight = FontWeight.Normal,48        ),49        titleLarge = TextStyle(50            fontFamily = PeachType.Display,51            fontSize = 24.sp,52            fontStyle = FontStyle.Italic,53            fontWeight = FontWeight.Light,54        ),55        labelLarge = TextStyle(56            fontFamily = PeachType.Body,57            fontSize = 12.sp,58            fontWeight = FontWeight.Medium,59        ),60    )6162    CompositionLocalProvider(63        LocalPeachAccent provides accent,64        LocalReduceMotion provides reduceMotion,65        LocalPeachColors provides peachDark(accent),66    ) {67        MaterialTheme(colorScheme = colors, typography = typography, content = content)68    }69}