Skip to content

Commit

Permalink
Merge pull request #5 from HomePass/master
Browse files Browse the repository at this point in the history
Added support for colours with alpha values.
  • Loading branch information
maxs15 committed Feb 9, 2016
2 parents e137aba + 414a51c commit f576828
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ios/RNSpinkit.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ - (UIColor*)getColorFromString:(NSString*)color
NSScanner *scanner = [NSScanner scannerWithString:color];
[scanner setScanLocation:1]; // bypass '#' character
[scanner scanHexInt:&rgbValue];

if (color.length == @"#00000000".length) {
return [UIColor colorWithRed:((rgbValue & 0xFF000000) >> 24)/255.0 green:((rgbValue & 0xFF0000) >> 16)/255.0 blue:((rgbValue & 0xFF00) >> 8)/255.0 alpha:(rgbValue & 0xFF)/255.0];
}

return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
}
Expand Down

0 comments on commit f576828

Please sign in to comment.