2023-随机色 以及 颜色 宏定义

随机色

CGFloat red = (float)(arc4random()%255)/256;
    CGFloat green = (float)(arc4random()%255)/256;
    CGFloat blue = (float)(arc4random()%255)/256;
    CGFloat alpha = (float)(arc4random()%255)/256;
    UIColor *color = [UIColor colorWithRed:red green:green blue:blue alpha:alpha];

宏定义

#define KMainBodyColor [UIColor colorWithRed:255/255.0f green:89/255.0f blue:66/255.0f alpha:1]//navigationBar主题颜色

#define JFRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]//获取随机颜色

#define JFRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define JFRGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(r)/255.0 blue:(r)/255.0 alpha:a]

#define JFClearColor [UIColor clearColor]// clear背景颜色

你可能感兴趣的:(2023-随机色 以及 颜色 宏定义)