LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

color property

I’m totally confused in trying to apply colors programmatically to an LED Boolean. Here’s what I observe and don’t understand:

 

 In attached VI, I set the first argument in the COLORS property array to 255 =blue and the second to 255000= green because I want the ON/TRUE state to be green and the OFF/FALSE state to be blue, as described in the COLORS(4) PROPERTY help section as follows:

 

 If you pass in two elements, this property uses the first element value for the False and True to False states. Similarly, this property uses the second element for the True and False to True states.”

 

When I run the VI and throw the toggle switch on and off, the LED stays blue all the time. When I right click on the LED and look at its properties, it shows the ON color with a blue square and the OFF color with a green square. More confusing is this: when I reverse the colors in the colors property array so the first argument is 255000/green and the second is 255/blue, I run the VI and the LED turns blue with the toggle ON and green with the toggle OFF, and the properties chart shows both ON and OFF with a blue square.

There’s inconsistency between the Help text, the properties chart, and the action of the VI. Can anyone explain what’s going on here? I’m using LabView 8.20.

0 Kudos
Message 1 of 25
(7,661 Views)
I see what you mean.  The behavior does seem wierd.
 
Are you sure about the numbers you are putting in?
 
The colors are in hex format RRGGBB according to the help file for Colors(4).
 
So green would be 00 FF 00 hex or 65280 decimal.
255000 in decimal would be 03 41 18 hex or 03 decimal red, 65 decimal green, 26 decimal blue. A very dark green.
 
It just seems like the numbers you are using are a hybrid of decimal bytes when it is looking for hex.
 
I am also curious as to what foreground color means versus background color for a boolean indicator.  It is not like it has a true background.
Message 2 of 25
(7,650 Views)
I noticed that the foreground color is the actual visible color and the background color is what shows up in the properties page. Now that seems pretty useless and confusing.  It does however solve your problem if you just want to change the on/off colors.  I have modified your post to clarify what I mean.  on= blue, off=yellow, and in the properties on=black, off=green.  Now I cannot for the life of me get the third and fourth state to spit out colors or strings.  And not being able to change blinking colors drives me mad Smiley Mad
 
Chris
Message 3 of 25
(7,641 Views)

This boolean color stuff drove me crazy years ago.

The attatched 8.2 example and illustration can help understand what is going on .

I am not sure it all makes sense unless there is some legacy support involved here.

Until Chris made the observation that the second element in the cluster showed up in the Properties page, I would have said the second elment is a mystery.

If you run my example with its default of only two color cluster values defining the colors, you will not see the T to F and F to T.

You can test this by togling Boolena 3 and clickcing on the "boolean.

If you click on the forth element of the color definition array and define a color for all four elements of the array, you will see the T to F and F to T.

All of the above refers to the color of the first element in the cluster. now moving onto Chris' observation re: the properties page.

It appears the the second element in the cluster does define the colors shown in the properties page and that chaging those colors set BOTH elements of the color cluster to the selected color.

This second cluster element behaviour leads me to agree with chris' observation "that seems pretty useless and confusing" !

I try to get this explained.

Ben

Message Edited by Ben on 11-11-2006 01:30 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Download All
Message 4 of 25
(7,628 Views)
Good call Ben,
You got me thinking when you mentioned legacy, and applied a classic LED to your VI.  The 2 element cluster becomes clear, as well as the definitions callout.  The modern LEDs are somewhat 3d and really do not have a visible background, more like a fade transition.  The more I use the classic controls and indicators the more I prefer them over the Modern.  I love the modern look but the functionality seems more on the older style.  For example, the last time I tried to make a control transparent, i was forced to use the classic style.  I guess because of how it is built, dono.
It also seems as though you can choose the blinking colors, as all four are transitioned.
 
The second element IS the element that Labview wants you to make the color change, or at least that is less confusing since the properties page will match your selection.
 
I would agree exactly why labview did what they did, I just wish it was documented in the help file.
 
Chris
Message 5 of 25
(7,604 Views)
I'm not sure what all 4 colors are for, but here's the code from the Property Pages VI that sets the color...

This doesn't explain anything about why the property needs four eight colors total, but it does at least show one correct way of using the property, which may be enough for you to get your work done.

Message Edited by Aristos Queue on 11-13-2006 01:25 PM

Message 6 of 25
(7,550 Views)
Thank you all very much for your help. I'm an absolute beginner at this. I still have trouble understanding what KIND of data the property wants to see.  When I create a constant at its input, a 2-d array pops up and I don't know what to put into it. The help file says hex format .so I assume FF00FF but when I use the probe tool to see what's going into it from other VIs I see data that looks like 16711680 for a red color, and I don't know how to generate data like that to correlate to the colors I want. And I don't know how to put the hex representation INTO the property. Thanks for bearing with me.
0 Kudos
Message 7 of 25
(7,509 Views)

WB,

I do not know hex or other conversions.  To avoid confusion, i always use a colorbox constant.  It is located in the functions pallatte>programming>graphics and sound>picture functions.  this automatically converts the color of choice to a number.  So basically wire exactly how Aristos Queue showed in the prevoious post just replace the Numeric controls with color box constants.

Chris

0 Kudos
Message 8 of 25
(7,499 Views)

Colors in LV are represented by a U32 where the three low order bytes represent the color components RGB where the B byte is the lowest order byte and the R byte is the highest order.

The confusion you are seeing is due to the values being shown in decimal while the doc's are refering to hex notation.

The attached VI and image may help illustrate.

Note: the highest order byte (I believe) is used for transparency (I think) but I have never mastered using this bytes.

 

Ben

Message Edited by Ben on 11-14-2006 07:50 AM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Download All
Message 9 of 25
(7,476 Views)
Thank you Ben & Chris. I'm trying to stuff color info into a color(4) property as shown on your modified vi attached. It only accepts things that will fit in the 1D array that pops up when you try to connect a constant. I'd like to be able to put the color boxes in there but it's a type mismatch. I want to use this property object because I'm also changing many other LED properties as well.
0 Kudos
Message 10 of 25
(7,438 Views)