08-23-2017 05:43 PM
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.
Any suggestions?
Norm
08-23-2017 06:34 PM
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.
08-24-2017 10:47 AM
I checked with the output with several dark and light colors, and I think the results give pretty good contrast.