paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

NIGHT mode renders Compose as NOT_NIGHT

Open carl-lightricks opened this issue 2 years ago • 2 comments

Setting up a DeviceConfig with NightMode.NIGHT, renders identical to NightMode.NOT_NIGHT. ie it does not make a difference and my Composable cannot be rendered in nightmode.

@get:Rule
    val paparazzi = Paparazzi(
        deviceConfig = DeviceConfig.NEXUS_5.copy(softButtons = false, screenHeight = 1, nightMode = NightMode.NIGHT),
        renderingMode = SessionParams.RenderingMode.V_SCROLL,
    )


    @Test
    fun largeLozengeButton() {
        paparazzi.snapshot {
            LargeLozengeButton(text = "New Project", {})
        }
    }

I am using this implements: app.cash.paparazzi:paparazzi-gradle-plugin:1.0.0-SNAPSHOT

carl-lightricks avatar Jun 01 '22 16:06 carl-lightricks

It looks like the frame of the system bars is affected by this setting, but Configuration.uiMode flags don't have Configuration.UI_MODE_NIGHT_YES in Configuration.UI_MODE_NIGHT_MASK. I will take a look into it to find a way to contribute a fix for this.

dniHze avatar Jun 23 '22 13:06 dniHze

Just created a workaround in #473. This theoretically should add support for night theming. This is what I got locally after applying the fix.

NightMode.NOTNIGHT NightMode.NIGHT
image image

But I also want to test how it affects views: DayNight themes and night resource qualifier before making it ready for review.

dniHze avatar Jun 24 '22 21:06 dniHze