






#import "UIColor+NotColor.h"

@implementation UIColor (NotColor)

+ (UIColor *)boyfriendMenJobPortraitSecureCommit:(NSString *)sobCoptic {
    if (sobCoptic.length <= 0) return nil;
    
    NSString *waterWinMap = [[sobCoptic stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
    CGFloat alpha, red, blue, green;
    switch ([waterWinMap length]) {
        case 3: 
            alpha = 1.0f;
            red   = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 0 length: 1];
            green = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 1 length: 1];
            blue  = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 2 length: 1];
            break;
        case 4: 
            alpha = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 0 length: 1];
            red   = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 1 length: 1];
            green = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 2 length: 1];
            blue  = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 3 length: 1];
            break;
        case 6: 
            alpha = 1.0f;
            red   = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 0 length: 2];
            green = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 2 length: 2];
            blue  = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 4 length: 2];
            break;
        case 8: 
            alpha = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 0 length: 2];
            red   = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 2 length: 2];
            green = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 4 length: 2];
            blue  = [self limitedDownloadDocumentsLeapPrecisionWarp: waterWinMap start: 6 length: 2];
            break;
        default: {
            NSAssert(NO, @"Color value %@ is invalid. It should be a hex value of the form #RBG, #ARGB, #RRGGBB, or #AARRGGBB", sobCoptic);
            return nil;
        }
            break;
    }
    return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
}

+ (CGFloat)limitedDownloadDocumentsLeapPrecisionWarp:(NSString *)string start:(NSUInteger)start length:(NSUInteger)length {
    NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
    NSString *aligned = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
    unsigned hexComponent;
    [[NSScanner scannerWithString: aligned] scanHexInt: &hexComponent];
    return hexComponent / 255.0;
}

- (UIColor *)tagHumidityDitheredSymbolicFlashPetite:(CGFloat)percentage {
    return [self newtonsDepartureHostUpdateAccountsTomorrow:percentage];
}

- (UIColor *)joinGuestCoverageDrainOneBlinding:(CGFloat)percentage {
    return [self newtonsDepartureHostUpdateAccountsTomorrow:-1*fabs(percentage)];
}

- (UIColor *)newtonsDepartureHostUpdateAccountsTomorrow:(CGFloat)percentage {
    CGFloat red,green,blue,alpha;
    if ([self getRed:&red green:&green blue:&blue alpha:&alpha]) {
        return [UIColor colorWithRed:MIN(red+percentage/100, 1.0) green:MIN(green+percentage/100, 1.0) blue:MIN(blue+percentage/100, 1.0) alpha:alpha];
    }else {
        return nil;
    }
}

@end
