From ab50921e88fbb95d0a0f1f57d71b0e7d4e444612 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 27 Sep 2023 15:34:49 -0500 Subject: [PATCH 1/3] added color extension for isDark Signed-off-by: Matt Bruce --- MVMCoreUI/Categories/UIColor+MFConvenience.h | 4 ++++ MVMCoreUI/Categories/UIColor+MFConvenience.m | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.h b/MVMCoreUI/Categories/UIColor+MFConvenience.h index 97280ba1..2bb81cd8 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.h +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.h @@ -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 diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.m b/MVMCoreUI/Categories/UIColor+MFConvenience.m index 8786df01..c185e7bb 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.m +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.m @@ -403,4 +403,10 @@ } } +- (BOOL)isDark { + CGFloat greyScale = 0; + [self getWhite:&greyScale alpha:nil]; + return greyScale < 0.5; +} + @end From f98c6059b8b2a307c699429b759d55d62a0502cd Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 27 Sep 2023 15:53:53 -0500 Subject: [PATCH 2/3] rearranged Signed-off-by: Matt Bruce --- MVMCoreUI/Categories/UIColor+MFConvenience.h | 6 +++--- MVMCoreUI/Categories/UIColor+MFConvenience.m | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.h b/MVMCoreUI/Categories/UIColor+MFConvenience.h index 2bb81cd8..10e9433d 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.h +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.h @@ -183,12 +183,12 @@ // Returns a gradient lighter color; + (nonnull UIColor *)mfGradientColor:(nullable UIColor *)color; +// Returns if the color is dark or not +- (BOOL)isDark; + #pragma mark - Hex String + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color; + (nonnull UIColor *)mfGetColorForHexWithTransparency:(nonnull NSString *)hexString; -// Returns if the color is dark or not -- (BOOL)isDark; - @end diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.m b/MVMCoreUI/Categories/UIColor+MFConvenience.m index c185e7bb..ac25ec22 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.m +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.m @@ -389,6 +389,12 @@ return [UIColor whiteColor]; } +- (BOOL)isDark { + CGFloat greyScale = 0; + [self getWhite:&greyScale alpha:nil]; + return greyScale < 0.5; +} + #pragma mark - Hex String + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color { @@ -403,10 +409,4 @@ } } -- (BOOL)isDark { - CGFloat greyScale = 0; - [self getWhite:&greyScale alpha:nil]; - return greyScale < 0.5; -} - @end From a19bd60f063d0a939ebb9c96dd80784bb0e8c6ea Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 27 Sep 2023 15:56:53 -0500 Subject: [PATCH 3/3] indented Signed-off-by: Matt Bruce --- MVMCoreUI/Categories/UIColor+MFConvenience.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.m b/MVMCoreUI/Categories/UIColor+MFConvenience.m index ac25ec22..cd809509 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.m +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.m @@ -390,9 +390,9 @@ } - (BOOL)isDark { - CGFloat greyScale = 0; - [self getWhite:&greyScale alpha:nil]; - return greyScale < 0.5; + CGFloat greyScale = 0; + [self getWhite:&greyScale alpha:nil]; + return greyScale < 0.5; } #pragma mark - Hex String