LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make a color box indicator transparent?

Here is a small VI and example of all the system colors that LabVIEW supports (as of about 7.0, when I wrote it).  I am not sure if the system text background color is represented, since this code is pretty old.  Have fun.
Message Edited by DFGray on 09-23-2008 09:00 AM
Message Edited by DFGray on 09-23-2008 09:01 AM
0 Kudos
Message 11 of 20
(1,612 Views)

@DFGray wrote:
  1. Set the color box to 16777271, the hard-coded value for this "color". 

It's a bit amusing that NI employees have to figure this stuff out through trial-and-error, and how this reveals their own individual level of understanding.

 

Strictly speaking, 8-bit RGB color is usually described as a 6-digit hex value, one octet (byte) per color. 

 

Labview colors are actually a 25-bit value, with the MSB being the transparent flag. Since this is a boolean state (either fully transparent, or not transparent), I would say that the canonical transparent value is 0x1000000. 16777271 is 0x1000037, with the superfluous 0x37 being a very dark shade of blue.

 

This is really obvious when you describe colors in hexadecimal, as they should be. Smiley Wink

 

Anyway, back to real work...

0 Kudos
Message 12 of 20
(952 Views)

@marshaul wrote:

@DFGray wrote:
  1. Set the color box to 16777271, the hard-coded value for this "color". 

It's a bit amusing that NI employees have to figure this stuff out through trial-and-error, and how this reveals their own individual level of understanding.

 

...

Labview colors are actually a 25-bit value, with the MSB being the transparent flag.

..

I would say that the canonical transparent value is 0x1000000. 16777271 is 0x1000037, with the superfluous 0x37 being a very dark shade of blue.

So, after 10 years you come up with misinformation? As has been documented and discussed, LabVIEW has also system colors. Have a look here for more information. In particular, the meaning of (0x01000037) is quite specific:

 

QUOTE: "There’s also a rather special color called “System Owner” (0x01000037). This means “be the color of your owner” and lets you make opaque areas on system-textured backgrounds."

0 Kudos
Message 13 of 20
(944 Views)

Misinformation? Your reference is interesting, and I was indeed evidently mistaken about the meaning of that 0x37. But the attached vi speaks for itself. 

 

Some of us like to actually try things instead of just repeating dogma until the end of time. Smiley Very Happy

 

And giving magic numbers without any sort of explanation or justification is still weak sauce. 

0 Kudos
Message 14 of 20
(920 Views)

Hi marshaul,

 

This is really obvious when you describe colors in hexadecimal, as they should be. … But the attached vi speaks for itself.

To have your VI "speak for itself" you should set the radix item to visible for your numeric constants - so anyone can notice instantly you set them to hex radix!

 

And giving magic numbers without any sort of explanation or justification is still weak sauce. 

So your reaction should be to create a new entry in the LabVIEW Ideas board to improve the LabVIEW help!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 20
(916 Views)

I could, but then again expressing 8-bit color in decimal makes zero sense, and is something I've never encountered outside of labview's little island. 

 

Besides, using the format string 0x%06.0x looks way better, anyway.

0 Kudos
Message 16 of 20
(919 Views)

Hi marshaul,

 

is something I've never encountered outside of labview's little island. 

In my experience other (textual) programming languages ALWAYS denote a numeric constant with a special char when that numeric value is not shown in decimal representation. So please do the same in LabVIEW!

Like in Pascal using a "$" to declare hexadecimal numeric values or using the "#" for HTML.

 

Besides, using the format string 0x%06.0x looks way better, anyway.

I prefer "× %x" (using the MultiplicationSign U+00D7) for hexadecimal values on frontpanels

 

but then again expressing 8-bit color in decimal makes zero sense

It makes no sense to use numeric constants when you could use colorboxes!

(It would be an improvement to colorboxes when they would show their color values (as hex) as tipstrip or would support an additional numeric display like sliders.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 20
(913 Views)

Good point! I used hex here because it was apropos the discussion (in actual production code I use color boxes to eliminate ambiguity), but just for the sake of argument I changed the constants in the empirical_misinformation VI to color boxes, and wouldn't you know it? 0x1000000 is defined as "T"! (Whereas 0x1000037 is just a white field.)

 

Boom! How's that for "misinformation"?

 

Empiricism > some article from the distant past > magic numbers

0 Kudos
Message 18 of 20
(904 Views)

As you can see from the attached code modification, x1000037 behaves quite differently.

 

This original ancient thread was about a colorbox indicator, and setting it to x1000037 has a very different outcome compared from setting it to x1000000 Compare the two arrays here. Only x1000037 makes it appear "transparent", i.e. whatever the background color is....

 

 

0 Kudos
Message 19 of 20
(902 Views)

Ah, that makes sense. And so the original answer given was correct for the OP's specific case. What originally spurred me to play around with this was the use of an unjustified magic number, which this thread provides a great reason never to do. Smiley Wink

0 Kudos
Message 20 of 20
(898 Views)