in reply to hex color generator

I'm curious; why are you replicating something that has already been done? There are many web sites out there which map colors to hex values for the web. Try a Google search for "web-safe color wheel hex". The first one that search returns is a neat little java applet which also shows you what it would look like on an actual page.

I was about to say "perhaps you wish to convert arbitrary decimal rbg values to hex rbg values and that's a different matter," but if this is for a CGI script, the output for colors not in the "web-safe" palette will vary from monitor to monitor. Thus, making arbitrary colors available is probably making much more work than is necessary for what you seem to have in mind.