Latest 1.0.1
Homepage https://github.com/needbee/nbthemeconfig
License MIT
Platforms ios 6.0, requires ARC
Authors

Configure all the colors for your app in a single plist

Demo

The demo/ folder contains a demo project showing NBThemeConfig in use.
Open and run it.

Usage

First, set up the colors, gradients, and patterns you want to use in
a file named theme.plist:

colors

Then, set up named components referring to different elements in your
app, and designate which color, gradient, or pattern it should get:

components

Then, instead of hard-coding colors in the .storyboard or in your code,
use NBThemeConfig’s methods to get the colors within your code,
referring to them by component name:

self.label.textColor
    = [NBThemeConfig colorForComponent:@"mainContentText"];
self.contentView.backgroundColor
    = [NBThemeConfig colorForComponent:@"mainContentBackground"];

Gradients are a bit more complex: set up a CAGradientLayer, then pass it
into:

[NBThemeConfig setGradient:myGradientLayer
    byComponentName:@"mainBackground"];

Compatibility

This class has been tested back to iOS 6.0.

Implementation

This class is implemented by loading color and pattern values from the
config file, caching them in class variables, and generating UIColors
from them using:

[UIColor colorWithRed:… green:… blue:… alpha:…];
[UIColor colorWithPatternImage:…];

License

This code is released under the MIT License. See the LICENSE file for
details.

Latest podspec

{
    "name": "NBThemeConfig",
    "version": "1.0.1",
    "summary": "Configure all the colors for your app in a single plist.",
    "homepage": "https://github.com/needbee/nbthemeconfig",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Josh Justice": "[email protected]"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "https://github.com/needbee/nbthemeconfig.git",
        "tag": "1.0.1"
    },
    "source_files": [
        "src",
        "src/**/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This