tags:

views:

244

answers:

1

Hi,

I'm trying to build a color picker view on the iPhone. I want to draw one of those 'color maps' and let the user tap on the color. I can create a gradient (in the X axis) ok which gives me the color range, but I also want to combine the lightness (in the Y axis) which is where I'm struggling.

Any help would be most welcome.

Thanks

PS: I've seen the example at http://www.v-vent.com/blog/?p=27 but this uses a colormap png file which is not very 'smooth'.

+1  A: 

Try working with the HSV or HSL color spaces. You can have the value/lightness or saturation on the Y axis.

Dinu Florin
In Apple's HSV color picker on the Mac, the angle is hue, radius is saturation, and a separate slider is brightness (value).
Peter Hosey
Yeah - I was wondering if anyone knew of a way to actually draw this. Looking at the CGGradient code there are only 2 options (linear and radial) I guess what I want is a 2D gradient.
Radial would work. You'd need at least four points in the gradient: One of the primary colors at each “end”, and the other two at the one-third and two-thirds points.
Peter Hosey