From 5ecb48871d3a173557881bbfc8ff510a63710155 Mon Sep 17 00:00:00 2001 From: machiav3lli Date: Sun, 10 Jul 2022 00:59:40 +0200 Subject: [PATCH] Add: Dynamic theme to compose --- .../com/machiav3lli/fdroid/ui/compose/theme/Theme.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/theme/Theme.kt b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/theme/Theme.kt index 2d4c7e78..e77c45ab 100644 --- a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/theme/Theme.kt +++ b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/theme/Theme.kt @@ -3,9 +3,13 @@ package com.machiav3lli.fdroid.ui.compose.theme import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext import com.machiav3lli.fdroid.utility.isBlackTheme +import com.machiav3lli.fdroid.utility.isDynamicColorsTheme @Composable fun AppTheme( @@ -15,7 +19,8 @@ fun AppTheme( ) { MaterialTheme( colorScheme = when { - //dynamicTheme -> dynamicDarkColorScheme(LocalContext.current) + isDynamicColorsTheme && isSystemInDarkTheme() -> dynamicDarkColorScheme(LocalContext.current) + isDynamicColorsTheme -> dynamicLightColorScheme(LocalContext.current) darkTheme && blackTheme -> BlackColors darkTheme -> DarkColors else -> LightColors