Dark mode demo not working
See original GitHub issueHi.
I’m using this code to change (and animate) dark mode from a debug drawer:
@Composable
fun RestaurantMenuNumbersTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
darkThemeState: MutableState<Boolean> = remember { mutableStateOf(darkTheme) },
content: @Composable (MutableState<Boolean>) -> Unit,
) {
val transition = updateTransition(targetState = darkThemeState.value)
val colors = if (darkThemeState.value) {
DarkColorPalette
} else {
LightColorPalette
}
val animateColors = Colors(
primary = transition.animateColor { colors.primary }.value,
primaryVariant = transition.animateColor { colors.primaryVariant }.value,
secondary = transition.animateColor { colors.secondary }.value,
secondaryVariant = transition.animateColor { colors.secondaryVariant }.value,
background = transition.animateColor { colors.background }.value,
surface = transition.animateColor { colors.surface }.value,
error = transition.animateColor { colors.error }.value,
onPrimary = transition.animateColor { colors.onPrimary }.value,
onSecondary = transition.animateColor { colors.onSecondary }.value,
onBackground = transition.animateColor { colors.onBackground }.value,
onSurface = transition.animateColor { colors.onSurface }.value,
onError = transition.animateColor { colors.onError }.value,
isLight = colors.isLight,
)
MaterialTheme(
colors = animateColors,
typography = Typography,
shapes = Shapes,
content = { content(darkThemeState) }
)
}
So, showkase not shows the dark mode / l right mode correctly
Issue Analytics
- State:
- Created 3 years ago
- Comments:18
Top Results From Across the Web
"Fyne error: Failed to set dark mode" loading fyne_demo · ...
I have my windows install running in dark mode. The Fyne demo loads in dark mode for me with this set. Changing it...
Read more >A Complete Guide to Dark Mode on the Web
Let's combine everything and create a working demo that: Automatically loads a dark or light theme based on system preferences; Allows the user ......
Read more >Not able to achieve dark mode using SwiftUI [duplicate]
I am using the above code to achieve dark mode on my demo project but its not working. Any help or insight would...
Read more >HubSpot | Dark Mode Demo
Demonstration on how one can implement a dark mode on a site using css variables ... Necessitatibus praesentium deserunt non ad, voluptatibus error...
Read more >Dark theme | Android Developers
Dark theme applies to both the Android system UI and apps running on the device. ... Other OEMs may or may not support...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Uhmmm, I think yes … but no worry, feel free to close this issue
I think this is because in the last screenshot, you have enabled dark mode system wide. That forces the other previews to also render what its supposed to render in dark mode. Was dark mode enabled system wide when you took the 3rd screenshot? @alorma