Simplifying HTML Color Code

I’m having trouble trying to simplify html color code…

I’m trying to figure out if there’s a formula in the hex code that will narrow down to basic colors (Red, Yellow, Blue, Green etc…)

here is the application i’m working on

I’ll upload an image and the php code with check the colors in the image and spit out the basic colors based on color popularity.

here is the example i have up now

the first option is obviously the background (white) php code will ignore the first array… second choice is the most relevant color.

what’s Kuler?

The point is for eCommerce applications… the client would upload a photo and it’ll extract the 2 - 3 most popular colors in the image and present it in the filtering system.

It can be used for other means for recognizing colors in images.

i’m sure there’s a formula that simplifies the hex code down to the basics.

You don’t think it’s a little to long the path to find out the hex color? Yes, it good for practice, but you can use tools like Kuler if you need something like that

Well Kuler is an flash web application who can generate color schemes event from pictures. Nice tool for a webdesigner. Now i understant what you want to do. But are you sure the script will select the right colors ? Maybe it will select backgound or a non relevant color.