Skip to content

Instantly share code, notes, and snippets.

@AndrewBarba
Last active August 29, 2015 14:06
Show Gist options
  • Save AndrewBarba/06a7723ccec99480f5f4 to your computer and use it in GitHub Desktop.
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
/**
* 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