CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Josh Justice.
Configure all the colors for your app in a single plist
The demo/ folder contains a demo project showing NBThemeConfig in use. Open and run it.
First, set up the colors, gradients, and patterns you want to use in a file named theme.plist:
Then, set up named components referring to different elements in your app, and designate which color, gradient, or pattern it should get:
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"];
This class has been tested back to iOS 6.0.
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:…];
This code is released under the MIT License. See the LICENSE file for details.