Calculating Color Contrast for Legible Text
particletree.com
particletree.com
A while ago, I wrote a little library to give a new random palette of colors using the ColorMatch.dk http://colormatch.dk/ algorithm - 7 color random palette: http://chir.ag/tech/download/7-color-random-palette/ (php). I used it a while for my tech blog and it worked pretty well. There is some code in there to make sure the foreground/background contrast is handled well, though I don't think it's as optimal as in the linked article. Still, could be interesting for others who like colors.
Lets you see what your site looks like with various forms of color-blindness.
And BTW, just black or white is not enough. There are some colors that are hard to read with either black or white. See the the wiki archive for some examples.