Revision: 39714
Updated Code
at March 10, 2011 07:34 by andrewroycarter
Updated Code
//In header #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] //usage UIColor *color = UIColorFromRGB(0x000000) //you can also use it inline [text.textField setTextColor:UIColorFromRGB(0xcccccc)]; #define PhotoshopColorValue(x) (x / 255.0) #define UIColorFromPhotoshopRGBA(r,g,b,a) [UIColor colorWithRed:PhotoshopColorValue(r) green:PhotoshopColorValue(g) blue:PhotoshopColorValue(b) alpha:a] #define UIColorFromPhotoshopHSBA(h,s,b,a) [UIColor colorWithHue:PhotoshopColorValue(h) saturation:PhotoshopColorValue(s) brightness:PhotoshopColorValue(b) alpha:a] #define UIColorFromHexValue(hex) UIColorFromPhotoshopRGBA(((hex & 0xFF0000) >> 16), ((hex & 0xFF00) >> 8), (hex & 0xFF), 1.0)
Revision: 39713
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 20, 2011 02:23 by andrewroycarter
Initial Code
//In header #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] //usage UIColor *color = UIColorFromRGB(0x000000) //you can also use it inline [text.textField setTextColor:UIColorFromRGB(0xcccccc)];
Initial URL
Initial Description
Initial Title
UIColor from Hex & Photoshop Values
Initial Tags
color
Initial Language
Objective C