Created
August 6, 2014 13:01
-
-
Save NSCabezon/863912cb354a311a5dfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIColor+UIColor_RandomColor.m | |
// | |
// Created by Ivan Cabezon on 06/08/14. | |
// Copyright (c) Ivan Cabezon. All rights reserved. | |
// | |
#import "UIColor+UIColor_RandomColor.h" | |
@implementation UIColor (UIColor_RandomColor) | |
+ (id)randomColor | |
{ | |
CGFloat hue = ( arc4random() % 256 / 256.0 ); | |
CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; | |
CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; | |
return [[self alloc] initWithHue:hue saturation:saturation brightness:brightness alpha:1]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment