How do I refer to the accent color in a SwiftUI component?

Viewed 46

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?
  }
}
1 Answers

Use as follows

struct MyActiveView: View {
  var body: some View {
    Text("Hello")
      .foregroundColor(Color.accentColor)   // << here !!
  }
}
Related