
kiwi.orbit.compose.ui.OrbitTheme.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ui Show documentation
Show all versions of ui Show documentation
Orbit UI Components for Jetpack Compose
The newest version!
package kiwi.orbit.compose.ui
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ReadOnlyComposable
import kiwi.orbit.compose.ui.foundation.Colors
import kiwi.orbit.compose.ui.foundation.ContentEmphasis
import kiwi.orbit.compose.ui.foundation.ElevationLevels
import kiwi.orbit.compose.ui.foundation.LocalColors
import kiwi.orbit.compose.ui.foundation.LocalContentColor
import kiwi.orbit.compose.ui.foundation.LocalContentEmphasis
import kiwi.orbit.compose.ui.foundation.LocalShapes
import kiwi.orbit.compose.ui.foundation.LocalTypography
import kiwi.orbit.compose.ui.foundation.ProvideMergedTextStyle
import kiwi.orbit.compose.ui.foundation.Shapes
import kiwi.orbit.compose.ui.foundation.Typography
import kiwi.orbit.compose.ui.foundation.rememberTextSelectionColors
@Composable
public fun OrbitTheme(
colors: Colors = OrbitTheme.colors,
typography: Typography = OrbitTheme.typography,
shapes: Shapes = OrbitTheme.shapes,
content: @Composable () -> Unit,
) {
val selectionColors = rememberTextSelectionColors(colors)
MaterialTheme(
colorScheme = colors.toMaterial3Colors(),
typography = typography.toMaterial3Typography(),
shapes = shapes.toMaterial3Shapes(),
) {
CompositionLocalProvider(
// Orbit
LocalColors provides colors,
LocalContentEmphasis provides ContentEmphasis.Normal,
LocalShapes provides shapes,
LocalTypography provides typography,
// Foundation
LocalContentColor provides colors.content.normal,
LocalTextSelectionColors provides selectionColors,
) {
ProvideMergedTextStyle(typography.bodyNormal, content)
}
}
}
public object OrbitTheme {
public val colors: Colors
@Composable
@ReadOnlyComposable
get() = LocalColors.current
public val typography: Typography
@Composable
@ReadOnlyComposable
get() = LocalTypography.current
public val shapes: Shapes
@Composable
@ReadOnlyComposable
get() = LocalShapes.current
public val elevations: ElevationLevels = ElevationLevels
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy