Casting Hex Colors
pedro380085 opened this issue · comments
Pedro Góes commented
Casting your hex values on info view is loosing some precision, here is the updated method:
CGFloat rFloat, gFloat, bFloat, aFloat;
[self getRed:&rFloat green:&gFloat blue:&bFloat alpha:&aFloat];
int r, g, b;
r = (int)ceilf(255.0 * rFloat);
g = (int)ceilf(255.0 * gFloat);
b = (int)ceilf(255.0 * bFloat);
return [NSString stringWithFormat:@"#%02x%02x%02x", r, g, b];