SwiftUI .tint()
Published Nov 22, 2023
Contribute to Docs
The .tint() modifier sets the tint color displayed in a view.
Syntax
Button("This is a button")
.tint(color)
The .tint() applies the color to the Button which conforms it to the View protocol.
Example
struct ContentView: View {var body: some View {Button("This is a button").tint(.blue)}}
In the above example, the .tint() modifier with the .blue parameter is called on the Button view. This applies the blue tint color to the button.
This will display the following:

Note: When a tint is applied to a view hierarchy, it only affects the text inside controls, like buttons and links, not plain Text views.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SwiftUI on Codecademy
- Learn how to build iOS applications with Swift and SwiftUI and publish them to Apples' App Store.
- Includes 7 Courses
- With Certificate
- Beginner Friendly.13 hours
- A powerful programming language developed by Apple for iOS, macOS, and more.
- Beginner Friendly.12 hours