Question

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.

Was it helpful?

Solution

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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top