I'd like to change the color of the default gradient that is drawn inside the NSProgressIndicator
bar. What's the easiest approach?
An NSProgressIndicator with a different colour in the drawn bar
4.2k Views Asked by Thunder At
4
There are 4 best solutions below
0

I was trying to change de Hue as others said, but I was getting a lot of issues to get the right specific color i wanted. Maybe I just don't understand the color system too much...
But what did worked for me, and seems to be the most direct way to get a specific color, was using the CIColorMonochrome filter, where You can set any RGB color you want:
and programmatically:
let myCustomColor: CIColor(red: 10, green: 10, blue: 10)
if let colorMonochrome = CIFilter(name: "CIColorMonochrome", parameters: [kCIInputColorKey: myCustomColor]) {
progressIndicator.contentFilters.append(colorMonochrome)
}
0

The easiest way is to change the HUE....refer the screen shot for better understanding...
Then you will have the Progress bar :
0

try this code. extract YRKSpinningProgressIndicator
class and use it as as-usual progress indicator
As suggested in this answer, you could apply a Core Image filter to recolour it. That'd be the easiest way, as you wouldn't have to animate it yourself.
If you wanted a completely different look, then override
drawRect:
and draw whatever you want, using[self doubleValue]
and[self maxValue]
to find out where to draw. That won't get you any animation or gradients for free though.