Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Version 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Jul 24, 2013
1 parent 313a80c commit 619c26f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion SAMCategories.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'SAMCategories'
spec.version = '0.2.0'
spec.version = '0.3.0'
spec.authors = { 'Sam Soffes' => 'sam@soff.es' }
spec.homepage = 'https://github.com/soffes/SAMCategories'
spec.summary = 'Foundation and UIKit categories.'
Expand Down
14 changes: 8 additions & 6 deletions SAMCategories/UIKit/UIColor+SAMAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ + (instancetype)sam_colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation lig


+ (instancetype)sam_colorWithCSS:(NSString *)css {
// Transparent
if ([css isEqualToString:@"transparent"]) {
return [self clearColor];
}

// RGB
if ([css hasPrefix:@"rgb"]) {
return [self sam_colorWithRGB:css];
Expand All @@ -57,6 +52,13 @@ + (instancetype)sam_colorWithCSS:(NSString *)css {


+ (instancetype)sam_colorWithCSSName:(NSString *)name {
name = [name lowercaseString];

// Transparent
if ([name isEqualToString:@"transparent"]) {
return [self clearColor];
}

static NSDictionary *namedColors = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Expand Down Expand Up @@ -230,7 +232,7 @@ + (instancetype)sam_colorWithCSSName:(NSString *)name {
};
});

NSString *rgb = namedColors[name.lowercaseString];
NSString *rgb = namedColors[name];
if (rgb) {
return [self sam_colorWithRGB:rgb];
}
Expand Down

0 comments on commit 619c26f

Please sign in to comment.