//
//  MyColors.m
//  zhuxun
//
//  Created by winsoft on 16/5/24.
//
//

#import "MyColors.h"

@implementation MyColors

//在线颜色
-(void)getAllColorByArray
{
    UIColor *colorOne = SahreColorRGB(0.937, 0.325, 0.314);
    UIColor *colorTwo = SahreColorRGB(0.925, 0.251, 0.478);
    UIColor *colorThree = SahreColorRGB(0.671, 0.278, 0.737);
    UIColor *colorFour = SahreColorRGB(0.494, 0.341, 0.761);
    UIColor *colorFive = SahreColorRGB(0.361, 0.420, 0.753);
    UIColor *colorSix = SahreColorRGB(0.259, 0.647, 0.961);
    UIColor *colorSeven = SahreColorRGB(0.161, 0.714, 0.965);
    UIColor *colorEight = SahreColorRGB(0.149, 0.776, 0.855);
    UIColor *colorNine = SahreColorRGB(0.149, 0.651, 0.604);
    UIColor *colorTen = SahreColorRGB(0.400, 0.733, 0.416);
    
    self.arrayColor = [NSArray arrayWithObjects:colorOne,colorTwo,colorThree,colorFour,colorFive,colorSix,colorSeven,colorEight,colorNine,colorTen, nil];
    
    
}

//离线颜色
-(void)getOffLineArrayColor
{
    UIColor *colorOneOff = SahreColorRGB(1.000, 0.804, 0.824);
    UIColor *colorTwoOff = SahreColorRGB(0.973, 0.733, 0.816);
    UIColor *colorThreeOff = SahreColorRGB(0.882, 0.745, 0.906);
    UIColor *colorFourOff = SahreColorRGB(0.820, 0.769, 0.914);
    UIColor *colorFiveOff = SahreColorRGB(0.773, 0.792, 0.914);
    UIColor *colorSixOff = SahreColorRGB(0.733, 0.871, 0.984);
    UIColor *colorSevenOff = SahreColorRGB(0.702, 0.898, 0.988);
    UIColor *colorEightOff = SahreColorRGB(0.698, 0.922, 0.949);
    UIColor *colorNineOff = SahreColorRGB(0.698, 0.875, 0.859);
    UIColor *colorTenOff = SahreColorRGB(0.784, 0.902, 0.788);
    
    self.offlineColors = [NSArray arrayWithObjects:colorOneOff,colorTwoOff,colorThreeOff,colorFourOff,colorFiveOff,colorSixOff,colorSevenOff,colorEightOff,colorNineOff,colorTenOff, nil];
}

+ (UIImage*) createImageWithColor: (UIColor*) color
{
    CGRect rect=CGRectMake(0,0,40, 40);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}

+ (UIColor *)createColorWithImage:(UIImage *)image{

    return [UIColor colorWithPatternImage:image];
}



#pragma mark  -  懒加载
-(NSArray *)offlineColors
{
    if (!_offlineColors) {
        [self getOffLineArrayColor];
    }
    return _offlineColors;
}

-(NSArray *)arrayColor
{
    if (!_arrayColor) {
        [self getAllColorByArray];
    }
    return _arrayColor;
}




@end
