09-23-2008 08:55 AM - edited 09-23-2008 09:01 AM
11-16-2018 10:57 AM - edited 11-16-2018 10:59 AM
@DFGray wrote:
- 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.
Anyway, back to real work...
11-16-2018 11:20 AM - edited 11-16-2018 11:20 AM
@marshaul wrote:
@DFGray wrote:
- 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."
11-19-2018 03:06 PM - edited 11-19-2018 03:07 PM
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.
And giving magic numbers without any sort of explanation or justification is still weak sauce.
11-19-2018 03:13 PM
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!
11-19-2018 03:25 PM - edited 11-19-2018 03:31 PM
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.
11-19-2018 03:37 PM - edited 11-19-2018 03:45 PM
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.)
11-19-2018 03:54 PM - edited 11-19-2018 03:54 PM
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
11-19-2018 03:58 PM
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....
11-19-2018 04:06 PM
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.