Skip to content

Instantly share code, notes, and snippets.

@gustavkarlsson
Last active March 27, 2021 09:31
Show Gist options
  • Save gustavkarlsson/05e8dffbb92c58d2d202401667bb28b7 to your computer and use it in GitHub Desktop.
Save gustavkarlsson/05e8dffbb92c58d2d202401667bb28b7 to your computer and use it in GitHub Desktop.
private val LocalColors = staticCompositionLocalOf { LightColorPalette }
@Composable
fun MyMaterialTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit,
) {
val colors = if (darkTheme) {
DarkColorPalette
} else {
LightColorPalette
}
CompositionLocalProvider(LocalColors provides colors) {
MaterialTheme(
colors = colors.material,
content = content,
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment