material-components / material-components-android-compose-theme-adapter

A library that enables reuse of Material themes defined in XML for theming in Jetpack Compose.
https://material-components.github.io/material-components-android-compose-theme-adapter/
Apache License 2.0
415 stars 40 forks source link

createMdcTheme() is missing secondaryVariant color in dark mode #92

Closed diana-seattle closed 2 years ago

diana-seattle commented 2 years ago

createMdcTheme() reads secondaryVariant from the applied theme, but does not set the value in darkColors(). The darkColors() function allows this because it defaults the secondaryVariant parameter to match secondary, but users of the theme adapter should have a choice.

That is, the line after this one:

https://github.com/material-components/material-components-android-compose-theme-adapter/blob/3d89d95f9ec39c253e8609c7a503425070cae53d/materialLib/src/main/java/com/google/android/material/composethemeadapter/MdcTheme.kt#L209

should be something like:

secondaryVariant = secondaryVariant.takeIf { it != Color.Unspecified } ?: secondary,

to allow users to have a secondaryVariant value that differs from secondary in dark mode.

Thank you.

ricknout commented 2 years ago

Fixed in 47a96fbd6c94a4609e382cf924570e5868afbc7a, it will go out with the next release (1.1.6). Thanks for reporting!