Используйте UIColor
или NSColor
:
-(void)rgbToHSBWithR:(float)red G:(float)green B:(float)blue {
// assuming values are in 0 - 1 range, if they are byte representations, divide them by 255
UIColor *color = [UIColor colorWithRed:red green:green blue:blue alpha:1];
float h, s, b;
if ([color getHue:&h saturation:&s brightness:&b alpha:NULL])
{
// h, s, & b now contain what you need
}
}