|
16 | 16 |
|
17 | 17 | #import "MDFTextAccessibility.h" |
18 | 18 |
|
19 | | -#import "private/MDFColorCalculations.h" |
20 | | -#import "private/MDFImageCalculations.h" |
21 | | -#import "private/NSArray+MDFUtils.h" |
| 19 | +#import "MDFColorCalculations.h" |
| 20 | +#import "MDFImageCalculations.h" |
| 21 | +#import "NSArray+MDFUtils.h" |
22 | 22 |
|
23 | 23 | static const CGFloat kMinContrastRatioNormalText = 4.5f; |
24 | 24 | static const CGFloat kMinContrastRatioLargeText = 3.0f; |
@@ -48,19 +48,21 @@ + (nullable UIColor *)textColorOnBackgroundImage:(nonnull UIImage *)backgroundIm |
48 | 48 | return nil; |
49 | 49 | } |
50 | 50 |
|
51 | | - return |
52 | | - [self textColorOnBackgroundColor:backgroundColor targetTextAlpha:targetTextAlpha font:font]; |
| 51 | + return [self textColorOnBackgroundColor:backgroundColor |
| 52 | + targetTextAlpha:targetTextAlpha |
| 53 | + font:font]; |
53 | 54 | } |
54 | 55 |
|
55 | 56 | + (nullable UIColor *)textColorOnBackgroundColor:(nonnull UIColor *)backgroundColor |
56 | 57 | targetTextAlpha:(CGFloat)targetTextAlpha |
57 | 58 | options:(MDFTextAccessibilityOptions)options { |
58 | 59 | NSArray *colors = @[ |
59 | | - [UIColor colorWithWhite:1 alpha:targetTextAlpha], |
60 | | - [UIColor colorWithWhite:0 alpha:targetTextAlpha] |
| 60 | + [UIColor colorWithWhite:1 alpha:targetTextAlpha], [UIColor colorWithWhite:0 |
| 61 | + alpha:targetTextAlpha] |
61 | 62 | ]; |
62 | | - UIColor *textColor = |
63 | | - [self textColorFromChoices:colors onBackgroundColor:backgroundColor options:options]; |
| 63 | + UIColor *textColor = [self textColorFromChoices:colors |
| 64 | + onBackgroundColor:backgroundColor |
| 65 | + options:options]; |
64 | 66 | return textColor; |
65 | 67 | } |
66 | 68 |
|
@@ -107,8 +109,9 @@ + (nullable UIColor *)textColorFromChoices:(nonnull NSArray<UIColor *> *)choices |
107 | 109 | } |
108 | 110 |
|
109 | 111 | CGFloat alpha = CGColorGetAlpha(choice.CGColor); |
110 | | - CGFloat minAlpha = |
111 | | - [self minAlphaOfTextColor:choice onBackgroundColor:backgroundColor options:options]; |
| 112 | + CGFloat minAlpha = [self minAlphaOfTextColor:choice |
| 113 | + onBackgroundColor:backgroundColor |
| 114 | + options:options]; |
112 | 115 | if (minAlpha > 0) { |
113 | 116 | if (alpha > minAlpha) { |
114 | 117 | NSAssert(NO, |
|
0 commit comments