1

How to change the color of Navigation "Back Button" (it's created automatically) to black, and the color of DisclosureGroup "Chevron" to another color?

enter image description here

I've tried to do .buttonStyle(PlainButtonStyle()) and .foregroundColor(.black)

struct ContentView: View {

    var body: some View {
    
        NavigationView {
            NavigationLink(destination: DetailView()) {
        
                Text("Go to details ->")
                    .foregroundColor(.purple)
                    .underline()
            }
        }
    }
}


struct DetailView: View {
    @State private var isExpanded = false
    
    var body: some View {
        VStack {
            DisclosureGroup("All Details", isExpanded: $isExpanded) {
                
            }.buttonStyle(PlainButtonStyle())
            .foregroundColor(.black)

            Spacer()
        }
        .padding()
    }
}
MikeMaus
  • 385
  • 3
  • 22

1 Answers1

3

Use .accentColor for such cases

demo

        DisclosureGroup("All Details", isExpanded: $isExpanded) {
            
        }
        .accentColor(.black)

ADDED

struct ContentView: View {

    var body: some View {
    
        NavigationView {
            NavigationLink(destination: DetailView()) {
        
                Text("Go to details ->")
                    .foregroundColor(.purple)
                    .underline()
            }
        }.accentColor(.black)
    }
}
MikeMaus
  • 385
  • 3
  • 22
Asperi
  • 228,894
  • 20
  • 464
  • 690