Skip to content

Commit 001cd9f

Browse files
author
jacobjrapoport
committed
modify the alpha of a referenced color
if you reference a color, e.g. “COLOR1” = “255,0,0,1”, “COLOR2” = “COLOR1” you can now append “:[alpha]” to the reference to modify it’s alpha, e.g. “COLOR2” = “COLOR1:0.2” will equate to “255,0,0,0.2”
1 parent 35acdac commit 001cd9f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

AWLThemeManager/AWLThemeManager.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ - (UIColor *)colorForKey:(NSString *)key forTheme:(NSString *)themeName
8888
NSString *colorValue = [self objectForKey:key forTheme:themeName];
8989
UIColor *color = [self colorFromString:colorValue];
9090
if (color == nil && [self isValidString:colorValue]) {
91+
NSArray* referenceColor = [colorValue componentsSeparatedByString: @":"];
92+
colorValue = referenceColor.firstObject;
9193
color = [self colorForKey:colorValue forTheme:themeName];
94+
if (referenceColor.count > 1) {
95+
color = [color colorWithAlphaComponent: [referenceColor[1] floatValue]];
96+
}
9297
}
9398

9499
return color;

0 commit comments

Comments
 (0)