It seems like some UI elements just don't use the preferred color scheme of their parent element:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Button("Hold Me") { }
.contextMenu(ContextMenu(menuItems: {
Button("I should be dark") { }
}))
}
.padding()
.preferredColorScheme(.dark)
}
}
If you set the device appearance to dark, then the context menu shows the correct color scheme.
Setting .preferredColorScheme(.dark)
to Button
directly doesn't help.
Aside from context menus, this applies to all sorts of elements: popovers, alerts, tips, ...
Is there a workaround for this?
Apple folks: FB13391355