Thread:Mathmagician/@comment-3508190-20120619000730

Can I consult you with a mathematical issue? I have another color problem. This one is slightly more complicated - too complicated for me anyway. I've been trying to "solve" it by blind experimentation, but that wasn't sensationally successful.

I want to highlight text by giving it a background color. Finding a color that matches the text alone would be easy enough, but it also has to match the page background. By "match" I mean the new color has to be clearly distinguishable from the text and from the background, but at the same time it would be nice if the new color would not break with the page's color scheme. Both the text color and the page color are variables of course.

Here's my test page:

http://jade-empire-in-style.com/findreplace/color-test.html

You'll see I didn't get far. Refresh a few times - the page uses random colors.

And this is the library I've been using:

https://github.com/harthur/color

Can you help me with this? 