I can get color hex from RGB.
Now, is there any way to get color hex from colorWithHue
?
return [UIColor colorWithHue:180.0f / 360.0f saturation:0.02f brightness:0.85f alpha:0.8f];
I can get color hex from RGB.
Now, is there any way to get color hex from colorWithHue
?
return [UIColor colorWithHue:180.0f / 360.0f saturation:0.02f brightness:0.85f alpha:0.8f];
You can use this method too i guess: How can I get a hex string from UIColor or from rgb
- (NSString *)hexStringForColor:(UIColor *)color {
const CGFloat *components = CGColorGetComponents(color.CGColor);
CGFloat r = components[0];
CGFloat g = components[1];
CGFloat b = components[2];
NSString *hexString=[NSString stringWithFormat:@"%02X%02X%02X", (int)(r * 255), (int)(g * 255), (int)(b * 255)];
return hexString;
}
UIColor *color = [UIColor colorWithHue:180.0f / 360.0f saturation:0.02f brightness:0.85f alpha:0.8f]; return [self hexStringForColor:color];
colorWithHue method of UIColor class returns an UIColor object. You can then use the following category to get the hex code.
https://github.com/burhanuddin353/TFTColor
[UIColor hexStringForColor:[UIColor colorWithHue:180/360.0f saturation:0.02f brightness:0.85f alpha:0.8f]];