Last active
March 27, 2021 09:31
-
-
Save gustavkarlsson/05e8dffbb92c58d2d202401667bb28b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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