This is just an example of how ChatGPT transitions from a clear background to a dark gray background for the content of the message when contextMenu is visible. Here are my codes:
struct ContentView: View {
var body: some View {
Text("Long press for menu")
.background(.clear)
.contextMenu {
Button {
print("Pills selected")
} label: {
Label("Pills", systemImage: "pills")
}
Button {
print("Heart selected")
} label: {
Label("Heart rate", systemImage: "heart")
}
Button {
print("ECG selected")
} label: {
Label("ECG", systemImage: "waveform.path.ecg")
}
}
}