-
Hi, I'm back again - sorry to keep bugging you guys 😬 SummaryIs there any guidance or possibly an example for handling custom colors based on the user's color scheme? For example, different background colors for dark or light mode. I've tried conditionally setting values based on the DetailsI need to set some custom color values based on the user's color scheme preference. In the original iOS-only project I accomplished this by getting the color scheme like this @Environment(\.colorScheme) private var colorScheme: ColorScheme Then setting the right color values based on the value of .background(colorScheme == .light ? offWhite : smokeyBlack) When I tried using this pattern in the Skip project, I got the error So then I tried to take the approach of using the Asset Catalog to store the conditional color values. When I tried to refer to an Asset Catalog color set (e.g.
So using the Asset Catalog for this purpose is probably not valid just yet. Thanks in advance! I hope y'all are having a great weekend. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
If there's not a solution for this yet, that's alright - I'll dig into figuring out how to accomplish this behavior from the Android side and handle it with |
Beta Was this translation helpful? Give feedback.
-
.colorScheme and .preferredColorScheme support are in the latest SkipUI (0.6.0). Use Xcode's File -> Packages -> Update to Latest to get it. Supporting this required some modifications to the Main.kt file that gets generated with skip init, though. Since you have an existing project, you'll have to edit its Main.kt. Instructions for doing so are in the SkipUI README's new Preferred Color Scheme topic: https://github.com/skiptools/skip-ui/blob/main/README.md#preferred-color-scheme Please let us know if you have any trouble! |
Beta Was this translation helpful? Give feedback.
.colorScheme and .preferredColorScheme support are in the latest SkipUI (0.6.0). Use Xcode's File -> Packages -> Update to Latest to get it.
Supporting this required some modifications to the Main.kt file that gets generated with skip init, though. Since you have an existing project, you'll have to edit its Main.kt. Instructions for doing so are in the SkipUI README's new Preferred Color Scheme topic:
https://github.com/skiptools/skip-ui/blob/main/README.md#preferred-color-scheme
Please let us know if you have any trouble!