Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Night Mode] Be able to create screenshot light & dark side by side #1822

Closed
RobinMaronier opened this issue Feb 3, 2025 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@RobinMaronier
Copy link

I'm using Paparazzi since long time now, and I used to generate 1 screenshot per night mode.
I'm trying to reduce the number of generated screenshots, and one try is to generate 1 screenshots for both theme.

My attempt was to generated (with compose) my composable in a Row 👍

 Row {
   Box(modifier = modifier.weight(1f)) {
    DSTheme(isDarkTheme = false) { preview() }
   }
   Box(modifier = modifier.weight(1f)) {
     DSTheme(isDarkTheme = true) { preview() }
    }
  }

(where DSTheme is defining a new CompositionLocalProvider)

And device config was set like this : DeviceConfig.PIXEL_5.copy(screenWidth = DeviceConfig.PIXEL_5.screenWidth * 2)

The result is : both side are in light theme, because even if I force the theme provided to light or dark, the final Provider will be the device setting, which is not UI_MODE_NIGHT_UNDEFINED, but necessary to be one of the NightMode.NIGHT/NOT_NIGHT

Is it possible to have a "NightMode.Undefined" which will be mapped to UI_MODE_NIGHT_UNDEFINED, to have the control of composable part themed ?

Thanks !

@RobinMaronier RobinMaronier added the enhancement New feature or request label Feb 3, 2025
@geoff-powell
Copy link
Collaborator

Could you provide a sample project with your issue?

From my understanding this doesn't seem like a paparazzi issue necessarily.
It seems like you should be able to change your design system composable DSTheme to force dark/light without having to mess with the UI_MODE.

Otherwise, the suggestion would be to generate snapshots for each light/dark mode.

@RobinMaronier
Copy link
Author

Thanks for your answer !

You're right, my bad.
Sorry for the noise 😄
My default value was the system config, I need to override the default value if my value has been already set before, and it's working :)

Thanks !

@geoff-powell
Copy link
Collaborator

Great! Glad to here its working for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants