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. | [reply] |
First, you haven't said whether this is a web question or not. Could be web, could
be TK, could be something else entirely.
But let's presume web since that's what most people mean when they
don't say since they don't think anything exists besides the web. {grin}
Depending on how cut-n-paste-and-clickable you want, you can use something
like GD or Image::Magick to generate a real image,
or you can use a BGCOLOR attribute of a table cell to generate a color.
More details upon request; please include your existing knowledge so we don't
repeat what you already have discovered.
-- Randal L. Schwartz, Perl hacker | [reply] |
If you create a CGI script to produce the colors, you'd probably be looping through
the possible combinations. Since you need the combinations to create the color,
you could use the color in the link back to your CGI, which would then "know" that the hex
value submitted "matched" the color picked.
happy coding
| [reply] |
Converting RGB to HEX is easy, you can use something like this:
my ($red,$green,$blue) = (100,100,100); #or whatever
$hex = sprintf("%x%x%x",$red,$green,$blue);
Then $hex would be assigned to the hex value of the desired RGB color ($red, $green, $blue).
The UI is up to you.
"What once was, was, and won't be again." | [reply] [d/l] [select] |
| [reply] |
Requesting more knowledge. Existing knowledge on this subject is at its minimum, so I'm quite sure what you tell me will be new for me. By the way, this is for the web. | [reply] |