Reputation: 4318
Default SwiftUI accent color is a kind of Blue. I want to make it White on Dark theme and Black on White theme.
Though when I set for example .accentColor(.red)
disabled buttons are properly grayed out and enabled buttons are red.
But when I set .accentColor(.primary)
I don't see any difference between disabled and enabled buttons. Why is like that?
I expect enabled to be for example white and disabled greyed out.
Upvotes: 1
Views: 3073
Reputation: 31
You can define a color on Assets named for example "accent", as White for Dark and Black for the rest. Then call that color for the accentColor. It works. Reference Asset Color
.accentColor(Color("accent"))
Upvotes: 1
Reputation: 11
You can use
.buttonStyle(PlainButtonStyle())
after your NavigationLink
or NavigationView
to disable using accent colors (blue by default).
Upvotes: 0