Skip to content

Instantly share code, notes, and snippets.

@jhonsore
Created February 9, 2016 19:58
Show Gist options
  • Save jhonsore/c441a84e6e5a4b38367f to your computer and use it in GitHub Desktop.
Save jhonsore/c441a84e6e5a4b38367f to your computer and use it in GitHub Desktop.
RGB to Uicolor
//source: https://coderwall.com/p/zz5ieg/rgb-to-uicolor
#define rgb(R,G,B) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:1.0]
#define rgba(R,G,B,A) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A]
mylabel.textColor = rgb(231, 76, 60);
myview.backgroundColor = rgba(231, 76, 60,0.2);
// Alpaha value max is 1 and min is 0 , you must use float point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment