views:

1776

answers:

1

Hey all,

I'm looking for a straight forward way to convert a color from RGB, grabbing it from a tool like Photoshop, then convert it to a UIColor. Since UIColor uses normalized gamut of 0.0 to 1.0 for each color space, I'm not sure how this is done.

Thanks for the solution.

+6  A: 

Your values are between 0 and 255. Use them to create a UIColor:

float r; float g; float b; float a;

[UIColor colorWithRed:r/255.f
                green:g/255.f
                 blue:b/255.f    
                alpha:a/255.f];
Kriem
Thanks Kriem! That helps.
Coocoo4Cocoa
You're welcome!
Kriem