Last active
August 29, 2015 14:06
-
-
Save AndrewBarba/06a7723ccec99480f5f4 to your computer and use it in GitHub Desktop.
Objective-C macro for easily creating UIColor instances with RGB values between 0 and 255
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
/** | |
* Example: UIColor *teal = UIColorMake(9.0, 171.0, 161.0, 1.0) | |
*/ | |
CG_INLINE UIColor* | |
__UIColorMake(CGFloat r, CGFloat g, CGFloat b, CGFloat a) | |
{ | |
return [UIColor colorWithRed:(r/255.0) green:(g/255.0) blue:(b/255.0) alpha:a]; | |
} | |
#define UIColorMake __UIColorMake |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment