Skip to content

Instantly share code, notes, and snippets.

@eevajonnapanula
Created May 21, 2024 14:49
Show Gist options
  • Save eevajonnapanula/19282e1aa2a78c82b097c56bb750da52 to your computer and use it in GitHub Desktop.
Save eevajonnapanula/19282e1aa2a78c82b097c56bb750da52 to your computer and use it in GitHub Desktop.
// Theme.kt
@Composable
fun AppTheme(
useDarkTheme: Boolean = isSystemInDarkTheme(),
theme: Theme? = null,
content: @Composable () -> Unit,
) {
val colors = when (theme) {
Theme.Dark -> DarkColors
Theme.Light -> LightColors
Theme.HighContrast -> HighContrast
null -> if (!useDarkTheme) {
LightColors
} else {
DarkColors
}
}
MaterialTheme(
colorScheme = colors,
content = content,
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment