added color extension for isDark

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-09-27 15:34:49 -05:00
parent b7a1cf6af6
commit ab50921e88
2 changed files with 10 additions and 0 deletions

View File

@ -187,4 +187,8 @@
+ (nullable NSString *)hexStringForColor:(nonnull UIColor*)color;
+ (nonnull UIColor *)mfGetColorForHexWithTransparency:(nonnull NSString *)hexString;
// Returns if the color is dark or not
- (BOOL)isDark;
@end

View File

@ -403,4 +403,10 @@
}
}
- (BOOL)isDark {
CGFloat greyScale = 0;
[self getWhite:&greyScale alpha:nil];
return greyScale < 0.5;
}
@end