Dirk Dirk - 3 months ago 16
Objective-C Question

Is there a custom control similar to NSLevelIndicator with reverse coloring?

I need a control similar to

NSLevelIndicator
in
NSContinuousCapacityLevelIndicatorStyle
, but with reverse coloring. With
NSLevelIndicator
, the colors are like this:
Green up to the warning level, yellow from warning to critical level, red from critical level onwards. This is fine for, say, a volume control. But I have a value that corresponds to the filling of a gas tank: I want green for a full tank, yellow for warning and red for empty.
I have not found any means to change the colors of
NSLevelIndicator
.

So, before I start to write my own custom control, is there a
NSControl
available somewhere that already does what I want (of course I googled before asking, but to no avail)?

Thanks for reading.

Answer

NSLevelIndicator (at least nowadays) does this automatically for you if you set a warning level higher than the critical level!