Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Monday, January 18, 2016

How to find good looking font color if background color is known?

\n"); // try 4096 colors for (r = 0; r <= 15; r++) { for (g = 0; g <= 15; g++) { for (b = 0; b <= 15; b++) { int red; int blue; int green; double cDiff; // brightness increasse like this: 00, 11,22, ..., ff red = (r << 4) | r; blue = (b << 4) | b; green = (g << 4) | g; cDiff = contrastDiff( red, green, blue, bred, bgreen, bblue ); if (cDiff < 5.0) continue; writeDiv(red, green, blue, out); } } } // finalize HTML document out.write("

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.