-
-
Save zwf/7787138 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
// For example: | |
// UIColorFromRGBA(0xffee00, 0.5) | |
// UIColorFromRGB(0xffee00) | |
static inline UIColor *UIColorFromRGBA(int rgb, float a) { | |
return [UIColor colorWithRed:((float)((rgb & 0xFF0000) >> 16))/255.0 | |
green:((float)((rgb & 0xFF00) >> 8))/255.0 | |
blue:((float)(rgb & 0xFF))/255.0 alpha:a]; | |
} | |
static inline UIColor *UIColorFromRGB(int rgb) { | |
return UIColorFromRGBA(rgb, 1.f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment