LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Make text stand out

I have a multi column list box that is a summary of of a number of units that are being tested. Each unit has its own row in the list box. I use background color on each row to indicate a type of status. For normal passing units I just use a white background with black foreground text. I have about a dozen different colors that I use and add others from time to time. I want a method to calculate a foreground color to be readable  given the background color. My 1st try was using color to RBG.vi then for each channel use 255 - i to give contrasting colors. Then take the three channels and feed them into RGB to color.vi to get the text foreground color. This is great for white and black not so good for other colors.

 

Capture.PNG

Any suggestions?

 

Norm

0 Kudos
Message 1 of 3
(2,719 Views)

Hi Norm,

 

Interesting question. What I would do is average the three color intensities together. If it is closer to 255, then it is lighter, and you want black text. If it is closer to 0, then it is darker, and you want white text. It may not work in every single case, but it's worth a try.

 

temp.png

Message 2 of 3
(2,703 Views)

I checked with the output with several dark and light colors, and I think the results give pretty good contrast.

 

temp.png

0 Kudos
Message 3 of 3
(2,646 Views)