Permalink
Browse files

Added random color class method.

  • Loading branch information...
1 parent 834200a commit a67b4a65be059774b1fc76358184bf4708101369 Marcel Ruegenberg committed Oct 18, 2012
Showing with 9 additions and 0 deletions.
  1. +5 −0 UIKit/Drawing/UIColor+HelperAdditions.h
  2. +4 −0 UIKit/Drawing/UIColor+HelperAdditions.m
@@ -26,6 +26,11 @@
*/
- (UIColor *)colorMultipliedByScalar:(CGFloat)scalar withMinimum:(CGFloat)min;
+/**
+ A fully saturated random color. use this for debugging your drawing code.
+ */
++ (UIColor *)randomColor;
+
@end
#define RGB(rVal, gVal, bVal) [UIColor colorWithRed:rVal green:gVal blue:bVal alpha:1.0]
@@ -40,4 +40,8 @@ - (UIColor *)colorMultipliedByScalar:(CGFloat)scalar {
return [self colorMultipliedByScalar:scalar withMinimum:0.0];
}
++ (UIColor *)randomColor {
+ return [UIColor colorWithHue:(rand() / (CGFloat)RAND_MAX) saturation:1.0 brightness:1.0 alpha:1.0];
+}
+
@end

0 comments on commit a67b4a6

Please sign in to comment.