Switfui: change color in 'menu'

in swiftui how can I change the text color when use "menu"? I mean I need that each text in pippo will be .red color as you can see in the code, but .foregroundColor(.red) do not works thanks

  var pippo = ["AAA","BBB","CCC", "DDD"]
    
    var body: some View {   
        Menu {
            ForEach(pippo, id: \.self) { item in
                Button {
                    //categoriaSelezionata = categoria
                } label: {
                    Text(item)
                        .foregroundColor(.red)
                }
            }
        } label: {
            HStack {
                Text("Select Theme")
                    .multilineTextAlignment(.center)
                Image(systemName: "chevron.down")
                    .foregroundColor(.gray)
            }
            .frame(maxWidth: .infinity)
            .padding(6)
        }
        
        
        Menu {
            ForEach(pippo, id: \.self) { item in
                Button(item) {
                    // azione
                }
                .foregroundColor(.red)
            }
        } label: {
            HStack {
                Text("Select Theme")
                Image(systemName: "chevron.down")
                    .foregroundColor(.gray)
            }
            .frame(maxWidth: .infinity)
            .padding(6)
        }
        .menuStyle(BorderlessButtonMenuStyle()) // Prova diversi stili
        .menuIndicator(.hidden) // Nasconde l'indicatore di default
        
        
    }
        

As far as I know you cannot change the styling for a menu item because the menu is displayed appropriately for the operating system it's running on. So, trying .foregroundColor(), .foregroundStyle(), .tint() etc. likely won't work.

The only way you can make a menu item red is by giving the Button the destructive role. This, by default, makes the item red, but it may also have other side effects that you may not want:

Button(role: .destructive)

From the documentation:

Use this role for a button that deletes user data, or performs an irreversible operation. A destructive button signals by its appearance that the user should carefully consider whether to tap or click the button. For example, SwiftUI presents a destructive button that you add with the swipeActions(edge:allowsFullSwipe:content:) modifier using a red background.

So please, use it wisely.

In the meantime, why not raise a feedback request, and ask for a way to tint a menu item? https://feedbackassistant.apple.com/

This would depend on the platforms. For example, on macOS you can use foregroundStyle to apply a color to the item, how on iOS it's currently not support.

Once you file the feedback request please post the ID here for the record. Thanks.

Switfui: change color in 'menu'
 
 
Q