Compiled Chronicles

A software development blog by Angelo Villegas

iOS: AVHexColor

AVHexColor is a class for iOS (iPhone & iPad) and OS X (Mac), inspired by the lack of hexadecimal colour integration of iOS.

Install

Recommended

Podfile

via CocoaPods

platform :ios
pod 'AVHexColor', '~> 1.1.0'

Alternatives

  1. Using git subtree
    • git subtree add --prefix=AVHexColor --squash https://github.com/anjerodesu/AVHexColor.git master
  2. Using git submodule
    • git submodule add https://github.com/anjerodesu/AVHexColor.git AVHexColor
  3. Download
    • Copy the AVHexColor.h and AVHexColor.m files and #import the header file (AVHexColor.h) to your project

Sample Usage:

self.view.backgroundColor = [AVColor colorWithHex: 0xff0000];

UIColor *randomColor = [AVColor randomColor];

Methods:

+ (AVColor *)colorWithHex:(UInt32)hexadecimal;
+ (AVColor *)colorWithHexString:(NSString *)hexadecimal;

And a lot of convenience methods…

License

AVHexColor is available under the MIT license. See the LICENSE file for more info.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *