Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Can probe the brightness in a monochrome colorspace.

Brightness is still a meaningful construct in a monochrome colorspace.
  • Loading branch information...
commit fca9ce8bc893133627db6c8ec7e339342aa0c23d 1 parent 6b5a39a
@fcanas authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 UIColor+HSV.m
View
5 UIColor+HSV.m
@@ -124,7 +124,10 @@ - (CGFloat)saturation {
- (CGFloat)brightness {
CGFloat h, s, v, a;
- [self getHue:&h saturation:&s brightness:&v alpha:&a];
+ if (![self getHue:&h saturation:&s brightness:&v alpha:&a]) {
+ const CGFloat *c = CGColorGetComponents(self.CGColor);
+ if ([self colorSpaceModel] == kCGColorSpaceModelMonochrome) return c[0];
+ }
return v;
}
Please sign in to comment.
Something went wrong with that request. Please try again.