Created
August 7, 2016 18:05
-
-
Save chockenberry/2431b40049d6a3618c3766852b4e4b34 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
// Created by Sean Heber on 4/12/12. | |
#import <UIKit/UIKit.h> | |
// If you work with a designer who specifies color in sRGB using 102,0,204, this category makes it simpler to instantiate | |
// a color with that specification: [UIColor colorWithRGB:102:0:204 alpha:1.0]; | |
@interface UIColor (RGB) | |
// NOTE: If you're using the extended sRGB color space, you'll want to use something other than UInt8 :-) | |
+ (UIColor *)colorWithRGB:(UInt8)r :(UInt8)g :(UInt8)b alpha:(CGFloat)alpha; | |
@end | |
@implementation UIColor (RGB) | |
+ (UIColor *)colorWithRGB:(UInt8)r :(UInt8)g :(UInt8)b alpha:(CGFloat)alpha | |
{ | |
return [self colorWithRed:r/255.f green:g/255.f blue:b/255.f alpha:alpha]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment