Skip to content

[Customer Center] Problem with theming colors (dark theme) #2428

@augusto-carmo-mesa

Description

@augusto-carmo-mesa

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:

Image

Dark Theme Example:

Image

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.

  1. Environment
    1. Platform: Android
    2. SDK version: 8.19.2
    3. OS version: API 34
    4. Android Studio version: Android Studio Meerkat Feature Drop | 2024.3.2 Patch 1
    5. How widespread is the issue. Percentage of devices affected: 100%

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions