Reputation: 3111
I'm using a custom Navigation Bar background color. Since the black color of the Navigation Title that's used in .light
mode would not be suitable I'm using the .toolbarColorScheme(.dark, for: .navigationBar)
modifier.
This works fine except that I'm also using a Menu
in the toolbar
which now of course also uses the .dark
mode but should use the .light
mode instead:
Is it possible to achieve this?
I tried to apply .preferredColorScheme(.light)
to the Menu
but this doesn't work.
This is my code:
NavigationView {
List {
Text("Row Title")
}
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Menu {
Button {
} label: {
Label("Report an Issue", systemImage: "exclamationmark.bubble")
}
Divider()
Button(role: .destructive) {
} label: {
Label("Delete", systemImage: "trash")
}
} label: {
Label("Perform action", systemImage: "ellipsis.circle")
}
}
}
.navigationTitle("My Documents")
.toolbarColorScheme(.dark, for: .navigationBar)
.toolbarBackground(Color.blue)
.toolbarBackground(.visible)
}
Upvotes: 0
Views: 257