Skip to content

Instantly share code, notes, and snippets.

@NSCabezon
Created August 6, 2014 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NSCabezon/863912cb354a311a5dfe to your computer and use it in GitHub Desktop.
Save NSCabezon/863912cb354a311a5dfe to your computer and use it in GitHub Desktop.
//
// 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