6
votes

enter image description here

In the image above id like to change -02:49 to a color such as Color.blue

I've tried:

struct ContentView: View {

    var body: some View {
        PlayerView().accentColor(Color.blue)

    }
}

and I've also tried adding it in the actual PlayerView as follows:

struct PlayerView: View {

    var body: some View {
        VStack{
            .... 

        }.navigationBarTitle(Text(“-2:49”))
         .accentColor(.blue)

    }

}

I've also tried:

   struct PlayerView: View {

    var body: some View {
        VStack{
            .... 

        }.navigationBarTitle(Text(“-2:49”).foregroundColor(.blue))

    }

}
3

3 Answers

11
votes

At this point for change color of navigationBarTitle their is no direct api in SwiftUI.

But you can change it like this,
1) Go to Interface.storyboard file inside your AppName WatchKit App.
2) Select Hosting Controller Scene, Go to File Inspector and change Global Tint to your Custom Color.

7
votes

With WatchOS7/Xcode12 using the SwiftUI App Lifecycle you won't have a storyboard.

There is now an AccentColor within the App assets which is how you can change it.

Xcode12 Accent Color

1
votes

The modifier to change text colour is .foregroundColor(), so you should write:

Text(“-2:49”).foregroundColor(.blue)

Accent colour is what was known in UIKit as tint colour, i.e. the colour of clickable items. ForegroundColor is used for nonclickable items to give them a certain colour.