kkla320 / GaugeProgressViewStyle

GaugeProgressViewStyle adds the Apple Watch gauge view to iOS.
MIT License
36 stars 1 forks source link

Indicator color should be settable #9

Open kkla320 opened 2 years ago

kkla320 commented 2 years ago

The color for the indicator color should be settable, so that user of the framework can change the color.

gabehoffman commented 2 years ago

It kind of is, you can do this

let myCustomAngularGradient = AngularGradient(
        colors: [
            .red,
            .purple,
            .blue
        ],
        center: .center,
        startAngle: .angularGradientGaugeStart,
        endAngle: .angularGradientGaugeEnd
    )

and then using it in code

ProgressView(value: progressValue) {
                VStack {
                    Text("\(throughput.formatted())s")
                    Text("\(name)")
                }
            }

            .progressViewStyle(
                .gauge(shape: myCustomAngularGradient, thickness: 32) {
                    Text(highValue.formatted())
                } upperLabel: {
                    Text(lowValue.formatted())
                }
            )
kkla320 commented 2 years ago

That is not exactly what I meant. I mean the color for the black circle, that shows the current value on the gauge. I think of something like this

ProgressView(value: progressValue)
    .progressViewStyle( .gauge(indicatorColor: .white))

or with a modifier on view

ProgressView(value: progressValue)
    .progressViewStyle( .gauge)
    .gaugeIndicatorColor(.white)