airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.13k stars 107 forks source link

Component details are not in light mode when system is in dark mode #220

Closed marcorighini closed 2 years ago

marcorighini commented 2 years ago

We have

@Composable
private fun DarkModeComponentCard(metadata: ShowkaseBrowserComponent) {
    val customConfiguration = Configuration(LocalConfiguration.current).apply {
        uiMode = Configuration.UI_MODE_NIGHT_YES
    }

    ComponentCardTitle("${metadata.componentName} [Dark Mode]")
    CompositionLocalProvider(LocalConfiguration provides customConfiguration) {
        ComponentCard(metadata)
    }
}

But for the other cards (that are expected to be in light mode) we are not overriding the mode to light, i.e. uiMode = Configuration.UI_MODE_NIGHT_NO.

For this reason, if the system is already in dark mode all the cards are showing the dark mode variant.

marcorighini commented 2 years ago

Possible fix https://github.com/airbnb/Showkase/pull/223

vinaygaba commented 2 years ago

Fixed! Thank you for your contribution @marcorighini