LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dialog color that matches tab in the XP theme too

We use system colors and dialog control for pretty much all our GUIs, but we've run into a problem when using a system background color on text labels on tab controls: There seems to be no system color that will match the theme color of a dialog tab control...

We use the text labels as names on dialog frames so we cannot use a transparent label, it must have a background color that matches the tab color. With the XP theme that color is a shade of white...so the "Panel and object" color does not match (it's a light shade of grey). With the classic theme the tab has the panel and object color allright, but the XP theme is different.

Is there a system color we've overlooked, or?
0 Kudos
Message 1 of 9
(3,565 Views)
> We use system colors and dialog control for pretty much all our GUIs,
> but we've run into a problem when using a system background color on
> text labels on tab controls: There seems to be no system color that
> will match the theme color of a dialog tab control...
>
> We use the text labels as names on dialog frames so we cannot use a
> transparent label, it must have a background color that matches the
> tab color. With the XP theme that color is a shade of white...so the
> "Panel and object" color does not match (it's a light shade of grey).
> With the classic theme the tab has the panel and object color
> allright, but the XP theme is different.
>
> Is there a system color we've overlooked, or?

Or perhaps system colors that aren't in the color
picker? In fact there
are lots of system colors. MS and Apple seemed to go wild with
something like fifty colors on Apple's and 18 or so on MS's. Since MS
went away from their theme for each holiday scheme, very few are used,
so the color picker shows six of them I think.

If you feel up to the experiment, build an array of numeric U32's with
01 in the upper byte and 000000 through 000040 or so in the lower three
bytes. In otherwords, start with the first value, then loop for about
50 or 60 iterations adding one each time. Then wire this to an array of
color numerics. The tricky part will be moving this on top of the tab
control and see which matches. It may help to color the array and
border of the color numeric transparent. Hopefully the XP color is
there. I can't help more since I don't have a PC to do the experiment on.

Greg McKaskle
Message 2 of 9
(3,565 Views)
What is the "01" in the upper byte for?

I did not know that was used for anything.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 9
(3,565 Views)
> What is the "01" in the upper byte for?
>
> I did not know that was used for anything.
>

The color format is xxrrggbb where xx means the uppers are reserved. If
xx is 00, then the lowers form the 24 bit rgb value. If nonzero, then
something else is going on and either the color is invalid or it has a
symbolic meaning, which is what the 01 indicates. And the other upper
byte values are still reserved for future use, like alpha channel for
example. Anyway, 01yyyyyy means we can have 2^24 symbolic colors, and
so far Apple and MS have used about fifty and the most common six are in
the color picker.

Greg Mckaskle
0 Kudos
Message 4 of 9
(3,565 Views)
We got away from using system colours on all of our GUIs for just this reason. Explicitly stated colours allow us to have a consistent looking GUI on whatever OS. Might be an idea so that whatever scheme the OS producers come up with, the GUI will still be usable. BTW, we had some comments in the code with system colurs and they disappeared against the background on Windoze XP.

Rob
0 Kudos
Message 5 of 9
(3,565 Views)
Thanks Greg!

The color I was looking for is 16777271,
works as expected (the color picker just shows it as black though). Can we have more system colors on the palette next time...?:-)
0 Kudos
Message 6 of 9
(3,565 Views)
The color is there, but somewhat hidden, since it is not a color as much as a command to match the background color. To get it, drop a dialog label from the dialog control palette onto a blank part of your VI and type a bit of text into it to make it stay around. Use the color copying tool to grab the color of the label, then the coloring tool to color whatever text you wish. No matter where you move it, the text background will be opaque and match the background color. If you are using a free label, just use the dialog label in the first place.

NOTE: This is an undocumented feature and not supported by NI, so use at your own risk.
Message 7 of 9
(3,565 Views)
I've overlooked the dialog label(!)...in this case we haven't used separate labels so the coloring Greg helped with was nice to get, but I'll use the dialog label in the future.
0 Kudos
Message 8 of 9
(3,565 Views)
We used to do that ourselves; but at a point we decided that it looked better to follow the windows theme. It takes some time to ensure that it looks OK on the most common themes, but it makes things look more "native" for the users.
0 Kudos
Message 9 of 9
(3,565 Views)