Closed tonyhallett closed 2 years ago
The harmonized code for Compose was intended for an internal build that unfortunately made it into the external build. It depended on having a small port of a couple of functions from MaterialColors from @ColorInt to Color. Without it, the colors would be wrong or error.
It has been removed. Helper theme code for Compose color harmony will not be exported at this time. Sorry for the misunderstanding.
Describe the bug In addition to Material Theme Builder Web - Export Android Views - custom color values same for unharmonized and harmonized there are also additional issues.
Custom color harmonized color roles generated with the Web Material Theme Builder are incorrect.
In addition to this there are multiple issues with the generated code - Export / Jetpack Compose (Theme.kt).
fun setupErrorColors(colorScheme: ColorScheme, isLight: Boolean): ColorScheme { val harmonizedError = MaterialColors.harmonize(error, colorScheme.primary) val roles = MaterialColors.getColorRoles(harmonizedError, isLight) //returns a colorScheme with newly harmonized error colors return colorScheme.copy( error = roles.color, // do you mean accent onError = roles.onColor, // do you mean onAccent errorContainer = roles.colorContainer, // do you mean accentContainer onErrorContainer = roles.onColorContainer // do you mean onAccentContainer ) }
@RequiresApi(Build.VERSION_CODES.S) @Composable fun HarmonizedTheme(
@Composable fun HarmonizedTheme( useDarkTheme: Boolean = isSystemInDarkTheme(), isDynamic: Boolean = true, content: @Composable() () -> Unit ) { val canDynamicColor = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S