Reputation: 5115
In the top level of my app I set .accentColor(.mySpecialColor)
. All buttons and active elements then behave nicely and use the color. But how do when I write my own component that also adheres to the accent color?
An example could be
struct MyActiveView: View {
var body: some View {
Text("Hello")
.foregroundColor( ?? ) // How do I refer to accent color here?
}
}
Upvotes: 1
Views: 64
Reputation: 257493
Use as follows
struct MyActiveView: View {
var body: some View {
Text("Hello")
.foregroundColor(Color.accentColor) // << here !!
}
}
Upvotes: 1