A Cocoa-Touch system for getting a color scheme in function of an image, like iTunes 11 does. It is designed as a general purpose class set, in wich LEColorPicker is the interface for your client code.
Release note: Current release (1.0) run faster in devices than simulator.
- Add the OpenGLES framework to your project.
- Drag the 'LEColorPickerDemo/LEColorPicker' folder into your project, and you are done.
First, you have to create an instance of a LEColorPicker
object. Then, LEColorPicker
class provides an instance method that receives an UIImage as input and returns a LEColorScheme
object. LEColorScheme will provide the three computed colors as properties.
#import "LEColorPicker.h"
...
LEColorPicker *colorPicker = [[LEColorPicker alloc] init];
LEColorScheme *colorScheme = [colorPicker colorSchemeFromImage:image];
aView.backgroundColor = [colorScheme backgroundColor];
titleTextField.textColor = [colorScheme primaryTextColor];
bodyTextField.textColor = [colorScheme secondaryTextColor];
...
All images are public domain. If you want to add your own testing images, drag the image to the Resources folder of the project, in Xcode. Don't use names with "Default" or will be filtered. Only PNG images are supported (for now) in the sample project.
This software is licensed under the MIT license.
Copyright (c) 2012 Luis Espinoza
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Andrey Tarantsov for ATPagingView.
User Olie from StackOverflow, for his function to get a RGBA pixel array from an UIImage.
User Seth Thompson from StackOverflow for his Mathematica code for pick the colors like iTunes 11.
Suggestions will be well received.
Mail [email protected]
Twitter @luis_espinoza
You can try the demo in your device via MacBuildServer.