Home > Blockchain >  macOS SwiftUI button foreground color changes after dark/light appearance change
macOS SwiftUI button foreground color changes after dark/light appearance change

Time:11-24

So I run the below code in playground and I see 2 buttons on light appearance, then I switch to dark mode. Both buttons update foreground color as part of SwiftUI framework to off-white. Then I tap on one button the foreground color on other button(s) changes to grey. See video attached below. Using Xcode 13.1


import SwiftUI
import PlaygroundSupport

struct ContentView: View {
    var body: some View {
        VStack {
            HStack {
                Text("Current")
                    .font(.subheadline)
                    .fontWeight(.semibold)
                    .foregroundColor(.gray)
                    .frame(maxWidth: .infinity, alignment: .leading)
                Label("43.672490, -79.388932", systemImage: "location")
                    .frame(width: 175, alignment: .trailing)
            }
            HStack {
                Button {} label: {
                    Text("           
  • Related