Created
October 24, 2022 10:57
-
-
Save tfaki/e3873843a2cef2fef464189776a38cc8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Composable | |
fun YourTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { | |
val dynamicColor = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S | |
val colors = if (dynamicColor) { | |
val context = LocalContext.current | |
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) | |
} else { | |
if (darkTheme) DarkColorPalette else LightColorPalette | |
} | |
MaterialTheme( | |
colorScheme = colors, | |
typography = Typography, | |
shapes = Shapes, | |
content = content | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment