Skip to content

Commit 7963695

Browse files
author
jacobjrapoport
committed
More precise colors
Increase the precision from float to double (CGFloat will define to double)
1 parent 001cd9f commit 7963695

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

AWLThemeManager/AWLThemeManager.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ - (UIColor *)colorForKey:(NSString *)key forTheme:(NSString *)themeName
9292
colorValue = referenceColor.firstObject;
9393
color = [self colorForKey:colorValue forTheme:themeName];
9494
if (referenceColor.count > 1) {
95-
color = [color colorWithAlphaComponent: [referenceColor[1] floatValue]];
95+
color = [color colorWithAlphaComponent: [referenceColor[1] doubleValue]];
9696
}
9797
}
9898

@@ -104,14 +104,14 @@ - (UIColor*)colorFromString:(NSString*)colorValue
104104
if ([self isValidString:colorValue]) {
105105
NSArray* array = [colorValue componentsSeparatedByString:@","];
106106
if (array && [array count] == 2) {
107-
return [UIColor colorWithWhite:[array[0] floatValue]
108-
alpha:[array[1] floatValue]];
107+
return [UIColor colorWithWhite:[array[0] doubleValue]
108+
alpha:[array[1] doubleValue]];
109109
}
110110
else if (array && [array count] == 4) {
111-
return [UIColor colorWithRed:[array[0] floatValue]/255
112-
green:[array[1] floatValue]/255
113-
blue:[array[2] floatValue]/255
114-
alpha:[array[3] floatValue]];
111+
return [UIColor colorWithRed:[array[0] doubleValue]/255.0
112+
green:[array[1] doubleValue]/255.0
113+
blue:[array[2] doubleValue]/255.0
114+
alpha:[array[3] doubleValue]];
115115
}
116116
}
117117

@@ -182,7 +182,7 @@ - (UIFont*)fontFromString:(NSString*)fontValue
182182
NSArray *array = [fontValue componentsSeparatedByString:@","];
183183
if (array && array.count == 2) {
184184
NSString *fontName = array[0];
185-
CGFloat fontSize = [array[1] floatValue];
185+
CGFloat fontSize = [array[1] doubleValue];
186186
if ([self isValidString:fontName]) {
187187
if ([fontName isEqualToString:@"bold"]) {
188188
font = [UIFont boldSystemFontOfSize:fontSize];

0 commit comments

Comments
 (0)