Robbe & Melisa Morris
Color Selection Via 510 Color Palette

By Robbe D. Morris

Printer Friendly Version

Purple keywords indicate links to related content.

This is more of a work horse example than a real technical article.  It's been placed here for your benefit.  The downloadable zip file at the bottom of the page contains the three files necessary for you to simply plug the functions into your page along with a default page to serve as the example of how to use it.   It's extremely easy.  I've also left a couple of functions for generating an array of colors and plugging them into an HTML table.  This sample of 510 colors is pretty "heavy".  You can adjust the color array function to only hold those colors desired (perhaps the JavaScript supported colors...).  The comments for the functions are in the "colorpalette.asp" file.
As part of building a friendly user interface, I needed to build a completely dynamic client side way of selecting colors and allow the user to see the result.  Plus, I wanted to store the values back into the database when the form was posted.  Visually, here's how it looks:

You selected:  

Selected Color:  

Download Code

Robbe has been a Microsoft MVP in C# since 2004.  He is also the co-founder of EggHeadCafe which provides .NET articles, book reviews, software reviews, and software download and purchase advice.