SwiftUI.cc
Snippets
EffectsEffect ModifiersBeginner

SwiftUI foregroundStyle and tint

Prefer foregroundStyle and tint for modern SwiftUI color styling, especially when controls, symbols, gradients, and semantic materials mix.

4 min readUpdated 2026-06
Semantic status row
import SwiftUI

struct SyncStatus: View {
    var body: some View {
        Label("Synced", systemImage: "checkmark.circle.fill")
            .font(.subheadline.weight(.medium))
            .foregroundStyle(.green)
            .padding(.horizontal, 10)
            .padding(.vertical, 6)
            .background(.green.opacity(0.12), in: Capsule())
            .tint(.green)
    }
}
Use this when

Text and symbols should use semantic or gradient styles.

A container should set the color of controls consistently.

You are modernizing older foregroundColor and accentColor usage.

Avoid this when

The color is a business state that should be encoded in a design token first.

The style makes labels fail contrast requirements.

The child view must intentionally override the inherited style.

Implementation notes

foregroundStyle accepts ShapeStyle values, so it works with colors, gradients, and materials.
tint is the modern way to influence many controls without reaching for deprecated accentColor patterns.
Inherited color can be useful, but be explicit around destructive, success, and warning states.

Checklist

Check contrast in both color schemes.

Use semantic names in your design system for repeated meanings.

Avoid using color alone to communicate state.

Related reference