Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How to Generate Random Colors Programmatically (ankerl.com)
6 points by Martha_Jackson on Dec 11, 2009 | hide | past | favorite | 2 comments


This is a nice article, but the central lesson is that you almost never want actual randomness - you want variation within useful limits.


I wrote a short method that when given a background color it will tell you whether or not white or black text will be the most readable. Using this you can still generate saturated colors but still have the text be readable.

You can find it here:

http://blog.nitriq.com/BlackVsWhiteText.aspx




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: