[Customer Center] Problem with theming colors (dark theme)
- [x] I have updated Purchases SDK to the latest version
- [x] I have read the Contribution Guidelines
- [x] I have searched the Community
- [x] I have read docs.revenuecat.com
- [x] I have searched for existing Github issues
Describe the bug For some reason, the color of the text in buttons of dialogs opened via Customer Center are hard to read due to their color. It happens for dark theme.
Light Theme Example:
Dark Theme Example:
Here's the code I'm using to display the Customer Center inside an Activity:
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
// ...
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
configureWindowInsets(
statusBarDarkIcons = !isDarkTheme(),
navigationBarDarkIcons = !isDarkTheme()
)
setContent {
var isCustomerCenterVisible by remember { mutableStateOf(true) }
LaunchedEffect(key1 = isCustomerCenterVisible) {
if (!isCustomerCenterVisible) {
onBackPressedDispatcher.onBackPressed()
}
}
val colorScheme = if (isSystemInDarkTheme()) {
darkColorScheme()
} else {
lightColorScheme()
}
MaterialTheme(colorScheme = colorScheme) {
if (isCustomerCenterVisible) {
CustomerCenter(
modifier = Modifier
.fillMaxSize(),
onDismiss = {
isCustomerCenterVisible = false
}
)
}
}
}
}
// ...
Obs.: This time around I can't use startActivity(ShowCustomerCenter().createIntent(requireContext(), Unit)). I have to use the composable version one.
- Environment
- Platform: Android
- SDK version: 8.19.2
- OS version: API 34
- Android Studio version: Android Studio Meerkat Feature Drop | 2024.3.2 Patch 1
- How widespread is the issue. Percentage of devices affected: 100%
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
Thank you for reporting @augusto-carmo-mesa
I am looking into it because I can definitely see weird behavior. Those buttons are not respecting the colors set in the Theme at all
@augusto-carmo-mesa ok, I found the answer to this. The buttons in the restore alert dialog will use whatever is set as accent color in the RevenueCat dashboard. We set that accent color as primary in the theme internally, so it will be used in other buttons in the Customer Center, like the Feedback survey ones, although this ones are not TextButtons but Buttons with a background.
Reopened issue. It was closed due to a failing automation. Sorry about that.