The Purpose
Back in the day when web-safe colors were an important idea, I wrote this
page in PHP. And it was a big table. Then I re-wrote it in JavaScript so that
it would not need a web
server to run. But at that time I didn't know much about the DOM so I literally
replaced all calls to echo () and print () with calls to document.write () and
called it a day.
Improvements
- I changed it to use the DOM and lots of DIVs that are floated.
- I added CSS styles.
- I write all the text into the DIVs first.
- Then I read all the DIVs content and set the background color to the same string.
- I set the text color to black or white depending on the luma of the background
color, instead of just averaging the RGB values. Luma counts green as a light color,
blue as a dark color, and red in between, in ratios of approximately R/G/B 30/60/10.
The buttons work like this:
- The first color increases from section to section.
- The second color increases within each section going down.
- The third color increases within each section going across.
Update 2015
I added the Hue, Saturation, and Value buttons, which sort by Hue, etc.
and give a hover popup that shows the HSV values.