CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

Adrian Sluijters

2pods

EMIHexiColor

# EMIHexiColor (NSColor+EMIHexiColor)

NSColor+EMIHexiColor is a compiler-aware category for both iOS and OS X to extend UIColor or NSColor with the capability to parse hex strings (6 characters long) i.e. AABBCC. It'll work well on shared code between iOS and Mac projects without you needing to alter code to accomodate either individually.'

Usage

Get the colors from a UIColoror NSColor from any of your favourite color pickers. And from there you:

```objc // iOS

import NSColor+EMIHexiColor.h

someViewYouWantToColor.backgroundColor = [AnyOSColor colorWithHexRGB:@"FF9500"]; objc // OS X

import NSColor+EMIHexiColor.h

someViewYouWantToColor.backgroundColor = [AnyOSColor colorWithHexRGB:@"FF0000"];

How It Works

AnyOSColor is actually a macro that is handled at compile time. depending on what you're compiling for i.e. iOS or OSX, AnyOSColor ultimately renders to UIColor ot NSColor.

Caveats

Because this category was needed in a hurry, alot of the input string checking was skipped (i.e. the hex string checking). Feel free to update it and let me know so i can add it to the repo for others to enjoy too.

Caveats

There are two demo's apps with the code, both for OS X and iOS.

Version

1.0.5

Mentions

This grand bottle of wine that kept me sane this evening!

License: MIT

  • Objective C

NSUIColor+FlatColors

A compiler-aware category for iOS and OS X to extend UIColor and NSColor with the flat colors from the Flat UI framework. http://designmodo.github.io/Flat-UI/

  • Switch from UIColor+FlatColors to NSUIColors+FlatColors with little or no code changes
  • Compiler aware and will work on iOS or OS X targets with little or no code changes

Importing:

  1. Common Import: #import "NSUIColor+FlatColors.h"
  2. iOS Import: #import "UIColor+FlatColors.h"
  3. OS X Import: #import "NSColor+FlatColors.h"

Use:

  1. Common or iOS Import: someViewYouWantToColor.backgroundColor = [UIColor flatEmeraldColor];
  2. Common or OS X Import: someViewYouWantToColor.backgroundColor = [NSColor flatEmeraldColor];

License: MIT

  • Objective C