- (BOOL)isEqualToColor:(UIColor*)otherColor {
CGColorSpaceRef colorSpaceRGB = CGColorSpaceCreateDeviceRGB();
UIColor*(^convertColorToRGBSpace)(UIColor*) = ^(UIColor*color) {
if (CGColorSpaceGetModel(CGColorGetColorSpace(color.CGColor)) == kCGColorSpaceModelMonochrome) {
constCGFloat*oldComponents =CGColorGetComponents(color.CGColor);
CGFloatcomponents[4] = {oldComponents[0], oldComponents[0], oldComponents[0], oldComponents[1]};
CGColorRefcolorRef =CGColorCreate( colorSpaceRGB, components );
UIColor*color = [UIColorcolorWithCGColor:colorRef];
CGColorRelease(colorRef);
returncolor;
}else
returncolor;
};
UIColor*selfColor = convertColorToRGBSpace(self);
otherColor = convertColorToRGBSpace(otherColor);
CGColorSpaceRelease(colorSpaceRGB);
return[selfColorisEqual:otherColor];
}