Compare Colour hue?

Hi there,

I’m trying to search through an array of colours and find ones with similar hues to a target colour.
I’ve tried checking for colours with similar rgb values but it isn’t quite giving me the results I’m looking for. I’d really like to check against the colour’s hue (like in the colour picker) without worrying so much about value.
Does anyone know how I could get this working? I was thinking it might be handy to be able to convert the RGB colors to HSV, but I’m not sure how to do this…

Any ideas?

Thanks
Pete

I think you are right about using HSV …comparing two colors in rgb, didnt work for me when i was experimenting with skin detection. I didnt find my original source, but i do have it somewhere and i can find it if this doesnt work:

I didnt test that one, but it looks ok. …and of course the formula can be found from wikipedia: HSL and HSV - Wikipedia

http://wiki.unity3d.com/index.php?title=HSBColor

–Eric

Awesome! thanks guys, thats perfect.