Gauge Colors
Customizing the colors of different styles with minimal effort
Platform Compatibility
Tags
SwiftUI Code
@State private var currentValue = 0.42
var body: some View {
VStack {
HStack {
Gauge(value: currentValue) {
Text("Foo")
} currentValueLabel: {
Text("42")
.foregroundColor(.indigo)
} minimumValueLabel: {
Text("0")
.foregroundColor(.mint)
} maximumValueLabel: {
Text("100")
.foregroundColor(.blue)
}
.gaugeStyle(.accessoryCircular)
Gauge(value: currentValue) {
Text("Foo")
} currentValueLabel: {
Text("42")
} minimumValueLabel: {
Text("0")
} maximumValueLabel: {
Text("100")
}
.gaugeStyle(.accessoryCircularCapacity)
}
Gauge(value: currentValue) {
Text("Foo")
} currentValueLabel: {
Text("42")
} minimumValueLabel: {
Text("0")
} maximumValueLabel: {
Text("100")
}
.gaugeStyle(.linearCapacity)
Gauge(value: currentValue) {
Text("Foo")
} currentValueLabel: {
Text("42")
} minimumValueLabel: {
Text("0")
} maximumValueLabel: {
Text("100")
}
.gaugeStyle(.accessoryLinear)
Gauge(value: currentValue) {
Text("Foo")
} currentValueLabel: {
Text("42")
} minimumValueLabel: {
Text("0")
} maximumValueLabel: {
Text("100")
}
.gaugeStyle(.accessoryLinearCapacity)
}
.tint(Gradient(colors: [.green, .orange, .red]))
.foregroundStyle(.brown)
}Found an issue or have a suggestion?
More Gauge Components
View allCircularGaugeStyle
A gauge style that displays an open ring with a marker that appears at a point along the ring to indicate the gauge’s current value
LinearGaugeStyle
A gauge style that displays a bar with a marker that appears at a point along the bar to indicate the gauge’s current value
AccessoryLinearCapacityGaugeStyle
A gauge style that displays bar that fills from leading to trailing edges as the gauge’s current value increases
AccessoryLinearGaugeStyle
A gauge style that displays bar with a marker that appears at a point along the bar to indicate the gauge’s current value
LinearCapacityGaugeStyle
A gauge style that displays a bar that fills from leading to trailing edges as the gauge’s current value increases
AccessoryCircularCapacityGaugeStyle
A gauge style that displays a closed ring that’s partially filled in to indicate the gauge’s current value
AccessoryCircularGaugeStyle
A gauge style that displays an open ring with a marker that appears at a point along the ring to indicate the gauge’s current value
Explore Other Components
Browse allColor Variants
HierarchicalShapeStyle, a shape style that maps to one of the numbered content styles
Tab View Customization
Specifies the customizations to apply to the sidebar representation of the tab view.