Post

Replies

Boosts

Views

Activity

Obtaining the RGB values for a color in darkMode
I have a colorSet which includes a "Any Appearance" color and a "Dark" color. I have a need to get the hex value of both. I know how to add a .colorScheme(.dark) view modifier to cause the view to adapt to darkMode. That is not the issue. I want to display a swatch containing the darkMode color and I want to display the hex value under the swatch. No matter what I do, it always returns the hex value of the "Any Appearance" version of the color. It seems that the solution might be to use Color.resolve(in:EnvironmentValues), but I do not see how to specify the needed EnvironmentValues
Topic: UI Frameworks SubTopic: SwiftUI
1
0
281
Sep ’24