material-foundation / material-theme-builder

Visualize dynamic color and create a custom Material Theme.
https://material-foundation.github.io/material-theme-builder/
Apache License 2.0
416 stars 30 forks source link

Jetpack Compose Theme Build problem #343

Open SURIart opened 3 months ago

SURIart commented 3 months ago

The problem is the new color theme updated from material Theme builder doesn't make changes to the app. the issue lie in theme building function ->

fun AppTheme( darkTheme: Boolean = isSystemInDarkTheme(), // Dynamic color is available on Android 12+ dynamicColor: Boolean = true, content: @Composable () -> Unit ) { val colorScheme = when { dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { val context = LocalContext.current if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) }

    darkTheme -> darkScheme
    else -> lightScheme
}

due to the darkTheme and dynamicColor the changes made in theme color doesn't apply to the app

if the darktheme and dynamic color is made false the applied colors comes

but since the functionality is quite important in some apps it would nice if u rectify this issue

Screenshot 2024-08-21 222815 see the above the set colors are different from the app colors