I am looking for a technique in which we could programmatically select the best color contrast for applying different (unpredictable) background colors to the text through HTML elements.
Since the HTML elements will have different colors, we are looking for a technique that can determine the color of the content behind the text, and then adapt the color of the text to use the one that has the best contrast.
I am sure that this cannot be just CSS, I was looking for jQuery solutions, but could not find anyone ... who has the key?
[UPDATE]: Based on the first answers, I think I need to rephrase. Imagine that I am creating an image-sharing service, and I want people to be able to tag photos themselves. Images can be any color. How can I choose the right tag color for every other image?
javascript css colors contrast
Julien Genestoux Apr 13 '11 at 2:30 p.m. 2011-04-13 14:30
source share