Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

White Color to RGB not correct

Check out the code

const CGFloat *c = CGColorGetComponents([[UIColor whiteColor] CGColor]); 
slider1.value = c[0];
slider2.value = c[1];
slider3.value = c[2];

c[2] is getting 0. For whiteColor all RGB values shld be 1.0. Why its not returning correct value for the blue component?

Any code snippet? for getting RGB values from white color?

like image 342
coure2011 Avatar asked Jan 21 '23 20:01

coure2011


1 Answers

Try CGColorGetColorSpace([[UIColor whiteColor] CGColor])

You will see it is not RGB. It has 2 components only: greyscale and alpha

like image 173
hooleyhoop Avatar answered Feb 05 '23 07:02

hooleyhoop