Level indicator item color choices


#1

The new “level indicator item” is VERY slick, but the colors are exactly backwards for MY needs… is there any way to reverse them so that RED is below a set level, YELLOW is intermediate, and GREEN is above a set level?


#2

I’m going to sound like a broken record here – but the level indicator item is another native Cocoa widget – in other words it’s supplied by Apple. And Apple has not provided any customization tools as far as the color goes.

ALL of the widgets in Panorama X are Cocoa widgets. I just went down the list of widgets Apple provides and made them available in Panorama X. (Of course the implementation of that is a lot tricker than it sounds in that sentence.) Basically you now have the same UI tools that Apple makes available in Xcode.


#3

If you subtract the values you are showing the level of from the maximum value, the colors will go as you want them. I guess you could invert the indicator if you want them to appear in the opposite direction.


#4

Bruce, the subtraction trick will fail to give us a battery capacity indicator: e.g. red from 1%-10%, yellow from 11%-20%, green > 20%. The level indicator in its actual form is acting like a manometer gauge, warning at high pressure.

Jim, this is not about adjusting the colors. This is about applying the scale upwards or downwards. I think the level indicator needs an option to invert the scale.


#5

Subtracting from 100% works fine. What does not work is rotating objects.


#6

Ah, I see. “Battery Capacity” (Minimum red, warning yellow, loaded green) works, indeed.


#7

Here is Apple’s documentation for NSLevelIndicator.

https://developer.apple.com/reference/appkit/nslevelindicator


#8

Well, I had to prove to myself that it was possible to “roll-your-own” battery level indicator as mentioned above. I believe my rendition pretty accurately emulates the standard Apple level indicator but works using custom colors for normal, warning and danger levels. Here a shots of it in action:

You can get the sample file called Battery Level Indicator and take from it what you want.

http://www.unseensoft.com/download/BatteryLevelIndicator.zip

It should be fairly simple to convert it for your own use. All the heavy lifting is already done. Note that the gradients used for the level bar were generated using my Gradient Workshop file which I have also made available.

http://www.unseensoft.com/GradientWorkshop.pandb.zip

The sample form also contains information on how it is constructed and how it works.


#9

You can manipulate the behavior of the level indicator perfectly with its property settings.

  • It will act like a battery capacity gauge when you set the warning and critical values near the minimum.

  • It will act like a pressure gauge (and switch the colors green and red) when you set the values for “warning” and for “critical” to near the maximum.

That’s working really nice.


#10

As many times before, Gary offered inspiration. I tried it myself now and have uploaded a sample file here: https://www.dropbox.com/s/1e4mc8fzclanwq5/Level%20Indicator.pandb.zip?dl=0

For the display, I used the level indicator properties only, and I used sliders and steppers to enter the values. As long the “Critical” level is set above the “Warning” level, the level indicator acts like a manometer, if it is below the “Warning” level, the indicator will act like a battery level indicator.