Color framework for Swift & Objective-C (Gradient colors, hexcode support, colors from images & more).

Related tags

Color chameleon
Overview

Chameleon by Vicc Alexander

Downloads Apps Platform: iOS 8+ Language: Swift 3 Carthage compatible CocoaPods compatible License: MIT

Swift 3

To use the Swift 3 version, add this to your Podfile (until 2.2 or higher is released):

pod 'ChameleonFramework/Swift', :git => 'https://github.com/ViccAlexander/Chameleon.git'

Introduction

Chameleon is a lightweight, yet powerful, color framework for iOS (Objective-C & Swift). It is built on the idea that software applications should function effortlessly while simultaneously maintaining their beautiful interfaces.

With Chameleon, you can easily stop tinkering with RGB values, wasting hours figuring out the right color combinations to use in your app, and worrying about whether your text will be readable on the various background colors of your app.

Features

Features

App Showcase

In an upcoming update we'll begin showcasing some of the best apps and companies making use of Chameleon. If you'd like to see your app featured in this section, make sure to add it here.

Table of Contents

● Product Features
● Requirements
● License
● Contributions
● Documentation
● Storyboard Add-On
● Author
● To Do List
● Change Log

🌟 Product Features

100% Flat & Gorgeous

Chameleon features over 24 hand-picked colors that come in both light and dark shades.

Swatches

Flat Color Schemes

Chameleon equips you with 3 different classes of flat color schemes that can be generated from a flat or non-flat color. In the examples below, the white stars indicate the color used to generate the schemes.

Analogous Flat Color Scheme

Analogous Scheme

Complementary Flat Color Scheme

Complementary Scheme

Triadic Flat Color Scheme

Triadic Scheme

Contrasting Text

With a plethora of color choices available for text, it's difficult to choose one that all users will appreciate and be able to read. Whether you're in doubt of your text and tint color choices, or afraid to let users customize their profile colors because it may disturb the legibility or usability of the app, you no longer have to worry. With Chameleon, you can ensure that all text stands out independent of the background color.

Oh... Chameleon works with the status bar as well. : )

Status Bar

Themes Beta

Chameleon now allows you easily theme your app with as little as one line of code. You can set a theme for all your views, and for specific views as well.

Themes

Colors From Images

Chameleon allows you to seamlessly extract non-flat or flat color schemes from images without hassle. You can also generate the average color from an image with ease. You can now mold the UI colors of a profile, or product based on an image!

Colors from images

Gradient Colors

With iOS 7 & 8, Apple mainstreamed flat colors. Now, with the release of iOS 9, Chameleon strives to elevate the game once more. Say hello to gradient colors. Using one line of code, you can easily set any object's color properties to a gradient (background colors, text colors, tint colors, etc). Other features, like Chameleon's contrasting feature, can also be applied to create a seamless product. Experimentation is encouraged, and gutsiness is applauded!

Gradients

Xcode Quick Help Documentation

Chameleon's documentation, while written as clearly and concisely as possible may still render some slightly confused. But don't fret! Staying true to our vision of simplifying the entire color process, we added Xcode Quick Help's Documentation Support! Simply highlight a Chameleon method or tap it with three fingers to find out more about what it is and what it does!

Xcode Quick Help Documentation

Palettes

If you're like us and love to use storyboards, Chameleon's got you covered. We've provided you with a quick and easy way to access Chameleon colors right from Storyboard, and any other app that uses the color picker (i.e. TextEdit). In addition you can even import the palette directly into Photoshop and Sketch.

Chameleon Palette

Chameleon Palette

⚠️ Requirements

  • Objective-C or Swift
  • Requires a minimum of iOS 7.0 for Objective-C (No active development for anything earlier, but may work with 6.0) and a minimum of iOS 8.0 for Swift.
  • Requires Xcode 6.3 for use in any iOS Project

🔑 License

Chameleon is released and distributed under the terms and conditions of the MIT license.

👥 Contributions

If you run into problems, please open up an issue. We also actively welcome pull requests. By contributing to Chameleon you agree that your contributions will be licensed under its MIT license.

If you use Chameleon in your app we would love to hear about it! Drop Vicc a line on twitter.

📗 Documentation

All methods, properties, and types available in Chameleon are documented below.

Documentation Table of Contents

● Installation
● Palettes
● Usage
● UIColor Methods
● Colors From Images
● UIStatusBarStyle Methods
● Color Scheme Methods
● Theme Methods

Installation

Note: Swift 3 version maintained in a separate branch until it's release.

CocoaPods Installation

Chameleon is now available on CocoaPods. Simply add the following to your project Podfile, and you'll be good to go.

Objective-C
use_frameworks!

pod 'ChameleonFramework'
Swift
use_frameworks!

pod 'ChameleonFramework/Swift'

=======

Carthage Installation

Add this to your Cartfile:

github "ViccAlexander/Chameleon"

=======

Manual Installation

If you rather install this framework manually, just drag and drop the Chameleon folder into your project, and make sure you check the following boxes. Note: Don't forget to manually import the QuartzCore & CoreGraphics framework if you plan on using gradient colors!

Manual Installation

If you're working with Swift and are manually installing Chameleon, there's an additional step. Make sure to download and drag the following file, ChameleonShorthand.swift, into your project, and you'll be good to go.

Palettes

Storyboard Add-On

Using Chameleon's awesome palette in Storyboard is easy! Simply download and install Chameleon Palette.

Once installed, make sure to restart Xcode. You'll find all of Chameleon's colors in the Palette Color Picker whenever they're needed! :)

Chameleon Palette

Chameleon Palette

Photoshop Add-On

Using Chameleon's awesome palette in Sketch is easy! Simply download and install Photoshop Palette.

Sketch Add-On

Using Chameleon's awesome palette in Sketch is easy! Simply download and install Sketch Palette.

Usage

To use the myriad of features in Chameleon, include the following import:

If you installed Chameleon using CocoaPods:
Objective-C
#import <ChameleonFramework/Chameleon.h>
Swift:
import ChameleonFramework
If you installed Chameleon using Carthage:
import Chameleon
If you installed Chameleon manually:
#import "Chameleon.h"

UIColor Methods

● Flat Colors
● Random Colors
● Complementary Colors
● Contrasting Colors
● Flattening Non-Flat Colors
● Gradient Colors
● Hex Colors
● Lighter & Darker Colors

Flat Colors

Using a flat color is as easy as adding any other color in your app (if not easier). For example, to set a view's background property to a flat color with a dark shade, you simply have to do the following:

Normal Convention:
Objective-C
self.view.backgroundColor = [UIColor flatGreenColorDark];
Swift
view.backgroundColor = UIColor.flatGreenDark
Chameleon Shorthand:
Objective-C
self.view.backgroundColor = FlatGreenDark;
Swift
view.backgroundColor = FlatGreenDark()

Setting the color for a light shade is the same, except without adding the Dark suffix. (By default, all colors without a Dark suffix are light shades). For example:

Normal Convention:
Objective-C
self.view.backgroundColor = [UIColor flatGreenColor];
Swift
view.backgroundColor = UIColor.flatGreen
Chameleon Shorthand:
Objective-C
self.view.backgroundColor = FlatGreen;
Swift
view.backgroundColor = FlatGreen()

Random Colors

There are four ways to generate a random flat color. If you have no preference as to whether you want a light shade or a dark shade, you can do the following:

Normal Convention:
Objective-C
self.view.backgroundColor = [UIColor randomFlatColor];
Swift
view.backgroundColor = UIColor.randomFlat
Chameleon Shorthand:
Objective-C
self.view.backgroundColor = RandomFlatColor;
Swift
view.backgroundColor = RandomFlatColor()

Otherwise, you can perform the following method call to specify whether it should return either a light or dark shade:

Normal Convention:
Objective-C
[UIColor colorWithRandomFlatColorOfShadeStyle:UIShadeStyleLight];
Swift
UIColor(randomFlatColorOfShadeStyle:.Light)
Chameleon Shorthand:
Objective-C
RandomFlatColorWithShade(UIShadeStyleLight);
Swift
RandomFlatColorWithShade(.Light)

UIShadeStyles:

  • UIShadeStyleLight (UIShadeStyle.Light in Swift)
  • UIShadeStyleDark (UIShadeStyle.Dark in Swift)
Choosing A Random Color From a List of Colors New

If you need to be a bit more selective and only display a random color from a set list of colors, you can use the following method:

Normal Convention:
Objective-C
[UIColor colorWithRandomColorInArray:@[FlatWhite, FlatRed, FlatBlue]];
Swift
TBA
Chameleon Shorthand:
Objective-C
RandomFlatColorInArray(@[FlatWhite, FlatRed, FlatBlue]) 
Swift
TBA
Choosing A Random Flat Color But Excluding A Few New

Last but certainly not least, you can also choose form the list of random colors and exclude the ones you don't want. For example say you want to randomly select a flat color for a user's profile, but don't want to use any blacks, grays, or whites. You can simply do:

Normal Convention:
Objective-C
[UIColor colorWithRandomFlatColorExcludingColorsInArray:@[FlatBlack, FlatBlackDark, FlatGray, FlatGrayDark, FlatWhite, FlatWhiteDark]];
Swift
TBA
Chameleon Shorthand:
Objective-C
RandomFlatColorExcluding(@[FlatBlack, FlatBlackDark, FlatGray, FlatGrayDark, FlatWhite, FlatWhiteDark]) 
Swift
TBA

Complementary Colors

To generate a complementary color, perform the following method call, remembering to specify the color whose complement you want:

Normal Convention:
Objective-C
[UIColor colorWithComplementaryFlatColorOf:(UIColor *)someUIColor];
Swift
UIColor(complementaryFlatColorOf:someUIColor)
Chameleon Shorthand:
Objective-C
ComplementaryFlatColorOf(color);
Swift
ComplementaryFlatColorOf(color)

Contrasting Colors

The contrasting color feature returns either a dark color a light color depending on what the Chameleon algorithm believes is a better choice. You can specify whether the dark or light colors are flat: ([UIColor flatWhiteColor] & [UIColor flatBlackColorDark]) or non-flat ([UIColor whiteColor] & [UIColor blackColor]).

If you're trying to set a UILabel's textColor property, make sure you provide the UILabel's backgroundColor. If your label has a clear backgroundColor, just provide the backgroundColor property of the object directly behind the UILabel.

Here's an example:

Normal Convention:
Objective-C
[UIColor colorWithContrastingBlackOrWhiteColorOn:(UIColor *)backgroundColor isFlat:(BOOL)flat];
Swift
UIColor(contrastingBlackOrWhiteColorOn:UIColor!, isFlat:Bool)
Chameleon Shorthand:
Objective-C
ContrastColor(backgroundColor, isFlat);
Swift
ContrastColor(backgroundColor, isFlat)

Flattening Non-Flat Colors

As mentioned previously, this feature is unique to Chameleon. While this feature is in its early stages of operation and can be improved, it is accurate in finding the nearest flat version of any color in the spectrum, and very simple to use:

Normal Convention:
Objective-C
[(UIColor *)color flatten];
Swift
UIColor.pink.flatten()

Gradient Colors

Using a gradient to color an object usually requires a couple of lines of code plus many more lines to superimpose smart contrasting text. Thankfully, Chameleon takes care of that for you. We've introduced a new way to have multicolored objects, and that's with gradients!

Gradient Styles

Chameleon provides three simple gradient styles. Gradients can be created from any number of colors you desire as long as at least two colors are provided. Don't forget that the contrasting text feature is also compatible with gradient colors!

UIGradientStyles:

  • UIGradientStyleLeftToRight (UIGradientStyle.LeftToRight in Swift)
  • UIGradientStyleTopToBottom (UIGradientStyle.TopToBottom in Swift)
  • UIGradientStyleRadial (UIGradientStyle.Radial in Swift)
Normal Convention:
Objective-C
[UIColor colorWithGradientStyle:(UIGradientStyle)gradientStyle withFrame:(CGRect)frame andColors:(NSArray<UIColor *> *)colors];
Swift
UIColor(gradientStyle:UIGradientStyle, withFrame:CGRect, andColors:[UIColor])
Chameleon Shorthand:
Objective-C
GradientColor(gradientStyle, frame, colors);
Swift
GradientColor(gradientStyle, frame, colors)

Objective-C Note: If you use the Chameleon Shorthand, and use the NSArray literal @[] to set the array of colors, make sure you add parenthesis around it, or else you'll get an error.

Note: UIGradientStyleRadial only uses a maximum of 2 colors at the moment. So if more colors are provided, they will not show.

Hex Colors

One of the most requested features, hex colors, is now available. You can simply provide a hex string with or without a # sign:

Normal Convention:
Objective-C
[UIColor colorWithHexString:(NSString *)string];
Swift
UIColor(hexString:string)
Chameleon Shorthand:
Objective-C
HexColor(hexString)
Swift
HexColor(hexString)

Hex Values New

Retrieving the hexValue of a UIColor is just as easy.

Objective-C
[FlatGreen hexValue]; //Returns @"2ecc71"
Swift
FlatGreen.hexValue //Returns @"2ecc71"

Lighter and Darker Colors

Sometimes all you need is a color a shade lighter or a shade darker. Well for those rare, but crucial moments, Chameleon's got you covered. You can now lighten any color the following way:

Normal Convention:
Objective-C
[color lightenByPercentage:(CGFloat)percentage];
Swift
color.lightenByPercentage(percentage: CGFloat)

You can also generate a darker version of a color:

Normal Convention:
Objective-C
[color darkenByPercentage:(CGFloat)percentage];
Swift
color.darkenByPercentage(percentage: CGFloat)

Colors From Images

Chameleon now supports the extraction of colors from images. You can either generate both flat and non-flat color schemes from an image, or easily extract the average color.

To generate a color scheme simply do the following:

Normal Convention:
Objective-C
[NSArray arrayOfColorsFromImage:(UIImage *)image withFlatScheme:(BOOL)flatScheme];
Swift (Array extension missing)
NSArray(ofColorsFromImage: UIImage, withFlatScheme: Bool)
Chameleon Shorthand:
Objective-C
ColorsFromImage(image, isFlatScheme)
Swift
ColorsFromImage(image, isFlatScheme)

To extract the average color from an image, you can also do:

Normal Convention:
Objective-C
[UIColor colorWithAverageColorFromImage:(UIImage *)image];
Swift
UIColor(averageColorFromImage: UIImage)
Chameleon Shorthand:
Objective-C
AverageColorFromImage(image)
Swift
AverageColorFromImage(image)

UIStatusBarStyle Methods

Contrasting UIStatusBarStyle

Many apps on the market, even the most popular ones, overlook this aspect of a beautiful app: the status bar style. Chameleon has done something no other framework has... it has created a new status bar style: UIStatusBarStyleContrast. Whether you have a ViewController embedded in a NavigationController, or not, you can do the following:

Normal Convention:
Objective-C
[self setStatusBarStyle:UIStatusBarStyleContrast];
Swift
self.setStatusBarStyle(UIStatusBarStyleContrast)
Note: Make sure that the key View controller-based status bar appearance in Info.plist is set to YES.

Color Schemes Methods

Note: Due to the limited number of flat colors currently available, color schemes may return results that reuse certain flat colors. Because of this redundancy, we have provided an option to return either a flat color scheme or a non-flat color scheme until more flat colors are added to the inventory.

The initial color can be either a non-flat color or flat color. Chameleon will return an NSArray of 5 UIColors in which the original color will be the third object of the scheme. This allows for Chameleon to designate the colors of the color scheme (2 colors counter-clockwise and 2 clockwise from the initial color), and thus, the chosen colors are aligned specifically in that order.

Analogous Color Scheme

An analogous color scheme uses three adjacent colors on the color wheel. According to Wikipedia, it’s best used with either warm or cool colors, creating a cohesive collection with certain temperature qualities as well as proper color harmony; however, this particular scheme lacks contrast and is less vibrant than complementary schemes. Within the scheme, choose one color to dominate and two to support. The remaining two colors should be used (along with black, white or gray) as accents.

Complementary Color Scheme

A complementary color scheme uses opposite colors on the color wheel. To put into slightly more technical terms, they are two colors that, when combined, produce a neutral color. Complementary colors are tricky to use extensively, but work well when you want a point of emphasis. Complementary colors are generally not favorable to use for text.

Triadic Color Scheme

A triadic scheme uses evenly spaced colors on the color wheel. The colors tend to be richly vivid and offer a higher degree of contrast while, at the same time, retain color harmony. Let one color dominate and use the two others for accent.

Getting Colors in a Color Scheme

To retrieve an array of colors, first make sure to initialize an NSMutableArray (in case you want to use the same array to replace with different colors later):

Normal Convention:
Objective-C
NSMutableArray *colorArray = [NSMutableArray alloc] initWithArray:[NSArray arrayOfColorsWithColorScheme:(ColorScheme)colorScheme 
                                                                                                    with:(UIColor *)color 
                                                                                             flatScheme:(BOOL)isFlatScheme]];
Swift
var colorArray = NSArray(ofColorsWithColorScheme:ColorScheme, with:UIColor!, flatScheme:Bool)
Chameleon Shorthand:
Objective-C
NSMutableArray *colorArray = [[NSMutableArray alloc] initWithArray:ColorScheme(colorSchemeType, color, isFlatScheme)];
Swift
var colorArray = ColorSchemeOf(colorSchemeType, color, isFlatScheme)
Example:

Assuming you want to generate an analogous color scheme for the light shade of Flat Red, perform the following method call:

Normal Convention:
Objective-C
NSMutableArray *colorArray = [NSMutableArray alloc] initWithArray:[NSArray arrayOfColorsWithColorScheme:ColorSchemeAnalogous
                                                                                                    with:[UIColor flatRedColor] 
                                                                                             flatScheme:YES]];
Swift
var colorArray = NSArray(ofColorsWithColorScheme:ColorScheme.Analogous, with:UIColor.flatRed, flatScheme:true)
Chameleon Shorthand:
Objective-C
NSMutableArray *colorArray = [[NSMutableArray alloc] initWithArray:ColorScheme(ColorSchemeAnalogous, FlatRed, YES)];
Swift
var colorArray = ColorSchemeOf(ColorScheme.Analogous, FlatRed(), true)

You can then retrieve each individual color the same way you would normally retrieve any object from an array:

Objective-C
UIColor *firstColor = colorArray[0];
Swift
var firstColor = colorArray[0] as! UIColor

Theme Methods

With Chameleon, you can now specify a global color theme with simply one line of code (It even takes care of dealing with the status bar style as well)! Here's one of three methods to get you started. ContentStyle allows you to decide whether text and a few other elements should be white, black, or whichever contrasts more over any UI element's backgroundColor.

To set a global theme, you can do the following in your app delegate:

Normal Convention:
Objective-C
[Chameleon setGlobalThemeUsingPrimaryColor:(UIColor *)color withContentStyle:(UIContentStyle)contentStyle];

But what if you want a different theme for a specific UIViewController? No problem, Chameleon allows you to override the global theme in any UIViewController and UINavigationController, by simply doing the following:

Normal Convention:
Objective-C
//This would go in the controller you specifically want to theme differently
[self setThemeUsingPrimaryColor:FlatMint withSecondaryColor:FlatBlue andContentStyle:UIContentStyleContrast];
Note: In order for the status bar style to automatically be set using a theme, you need to make sure that the View controller-based status bar appearance key in Info.plist is set to NO.

Navigation Bar Hairline

No Hairline

As of 2.0.3 the navigation bar hairline view is no longer hidden by default. However, if you're seeking a true flat look (like the image above), you can hide the hairline at the bottom of the navigation bar by doing the following:

Objective-C
[self.navigationController setHidesNavigationBarHairline:YES];

//or

self.navigationController.hidesNavigationBarHairline = YES;
Swift
self.navigationController?.hidesNavigationBarHairline = true

👑 Author

Chameleon was developed by Vicc Alexander (@ViccsMind) in 2014 using Objective-C. In 2015, full Swift support was implemented by @Bre7. Currently, it is being maintained by both @ViccAlexander and @Bre7.

📝 To Do List

  • CocoaPods Support 1.0.1
  • Table of Contents 1.0.1
  • Storyboard Color Picker Add-On 1.1.0
  • Xcode In-App Documentation 1.1.0
  • Switch from RGB values over to HSB and LAB 1.1.0
  • Gradient Colors 1.1.0
  • Update GradientStyle & ShadeStyle Syntax 1.1.1
  • Add Radial Gradient Support 1.1.1
  • Fix Swift Conflict with initWithArray:for:flatScheme: method 1.1.12
  • Swift Support 1.1.3
  • Color Scheme From Images 2.0.0
  • UIAppearance Convenience Methods 2.0.0
  • Add option to hide NavigationBar hairline 2.0.3
  • Add support for App Extensions hairline 2.2.0
  • Add Swift Support for Random Colors
  • Allow Gradient Colors to Adapt To Frame Changes

📄 Change Log

See Changelog.md 👀

Comments
  • v2 questions

    v2 questions

    1. Typo in the definition ? It's in the #pragma mark - Class Methods section
    2. In UIViewController+Chameleon.h the method flatify() is empty (Line 97)
    3. In findColorsOfImage(...), won't the NSArray and NSCountedSet have the same colors ?
    Question 
    opened by bre7 19
  • [Feature/Update] Update to Swift v3 Compliance

    [Feature/Update] Update to Swift v3 Compliance

    Swift 3 changes the name convention to lowerCamelCase

    let color: UIColor = .white
    

    Updating Chameleon to this convention, in addition to making them members of a class instead of a function, with put this framework into compliance.

    let color: UIColor = .flatWhite
    

    Awesome job overall though! I love this framework!

    Enhancement Planned Waiting on Input 
    opened by MatrixSenpai 15
  • Cocoapod Error: Chameleon.h not found

    Cocoapod Error: Chameleon.h not found

    @bre7 I didn't want to move the Chameleon.h file you added just in case it broke any dependencies, however I added a copy back into the Pod folder to fix the error.

    Bug Completed 
    opened by vicc 15
  • Gradient background and Swift

    Gradient background and Swift

    Attempting to style a gradient background using the code below renders a solid black background.

    let colors:[UIColor] = [
       UIColor(red: 0/255, green: 118/255, blue: 162/255, alpha: 1.0),
       UIColor(red: 0/255, green: 85/255, blue: 116/255, alpha: 1.0)
    ]
    
    self.backgroundColor = GradientColor(.TopToBottom, self.frame, colors)
    

    Xcode 7 iOS9 Swift 2 SpriteKit

    Enhancement No Issue 
    opened by RayHughes 12
  • Gradient don't fit with my view

    Gradient don't fit with my view

    Hi, i'm trying to add a gradient background for my UIView but, unfortunately, it don't fit with my desired width (screen width). The gradient contains black + transparent.

    Code:

    let colors:[UIColor] = [.blackColor(), .clearColor()]
    
    fadeBackground.backgroundColor = GradientColor(.LeftToRight, fadeBackground.frame, colors)
    

    *ps is my first project in iOS and i'm working with Swift

    Portrait:

    screen shot 2015-10-07 at 14 51 53

    Landscape:

    screen shot 2015-10-07 at 14 49 56

    No Issue More Info Needed 
    opened by ZigZag47 12
  • Cannot use Chameleon with Carthage for objective-C project

    Cannot use Chameleon with Carthage for objective-C project

    Hi, I'm using Chameleon install by Carthage for my Objective-C project, my code: self.view.backgroundColor = FlatGreen; App crashed and the xcode said: +[UIColor flatGreenColor]: unrecognized selector sent to class

    Bug More Info Needed 
    opened by haithngn 11
  • SFSafariViewController looks weird

    SFSafariViewController looks weird

    Hi,

    SFSafariViewController views presented in apps using Chameleon are using part of the color scheme, and they do not look ok.

    For instance, to the demo app I added an IBAction to the example button with the code:

    @IBAction func openSafari(sender: AnyObject) {
         if #available(iOS 9.0, *) {
             let safariView = SFSafariViewController(URL: NSURL(string: "https://duckduckgo.com")!)
             self.presentViewController(safariView, animated: true, completion: nil)
         }
     }
    

    When clicking the button the presented SFSafariViewController looks: screen shot 2015-10-14 at 6 15 31 pm

    You can notice the URL bar and the done button have the background color, but the rest of the navbar and status bars have the standard grey.

    Is there a way to have the SFSafariViewController fully themed or can I add an exception to leave SFSafariViewController with the default color schema?

    Thanks!

    Bug Enhancement Not Planned Looking Into This 
    opened by badgercl 10
  • Problem adding files

    Problem adding files

    I'm having problems adding the files to my swift project. I keep getting errors in the short hand class. Can you please explaining a little bit more on how to integrate it? Thank you

    Question 
    opened by ad-moh 10
  • Cocoapods alert for objc project

    Cocoapods alert for objc project

    Hi, is there any configuration in pod's file can define version for objc? From Cocoapods:

    [!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt into using it.
    
    Bug Completed Question Looking Into This 
    opened by qiaoyan 10
  • Set up UIAppearance globally?

    Set up UIAppearance globally?

    I read through documentation twice and there's no mention of setting global UIAppearance. I'd like to set colors once in AppDelegate globally and not insert 'set color' into each and every one view controller.

    What is the best practice for setting global UIAppearance or is there an example?

    Enhancement Completed 
    opened by romanr 10
  • UIMenuViewController button style

    UIMenuViewController button style

    png

    UIColor *c = [UIColor colorWithGradientStyle:UIGradientStyleRadial withFrame:CGRectMake(0, 0, 960, 960) andColors:@[[UIColor flatBlueColor], [UIColor flatPowderBlueColor]] ];
    [Chameleon setGlobalThemeUsingPrimaryColor:c withSecondaryColor:c andContentStyle:UIContentStyleLight];
    

    button is ugly

    Bug Not Planned 
    opened by skytoup 9
  • Build fails with message

    Build fails with message "Function produces expected type 'UIColor()'; did you mean to call it with '()'?"

    Build fails with message "Function produces expected type 'UIColor()'; did you mean to call it with '()'?" in Xcode 12, Swift 5. Anyone having similar issue? Is this library no longer supported?

    opened by junsukim1994 1
  • Building not working on Xcode 12

    Building not working on Xcode 12

    On Xcode 12 the scheme doesn’t build and gives;

    Build Failed Task failed with exit code 65: /usr/bin/xcrun xcodebuild -project /Users/brambeekman/Documents/brambeekman/apps/Rullesmulle/Carthage/Checkouts/Chameleon/Chameleon.xcodeproj -scheme Chameleon -configuration Release -derivedDataPath /Users/brambeekman/Library/Caches/org.carthage.CarthageKit/DerivedData/12.4_12D4e/Chameleon/2.2.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive VALIDATE_WORKSPACE=NO -archivePath /var/folders/7j/zrv3d86j4m7_tyzjllzw0d2h0000gn/T/Chameleon SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/brambeekman/Documents/brambeekman/apps/Rullesmulle/Carthage/Checkouts/Chameleon)

    opened by brambeekman 0
  • Gradient starts giving rare hex values

    Gradient starts giving rare hex values

    When i run this code:

    for x in 1...10 {
                print("\(CGFloat(x) / CGFloat(10) * 100)%")
                print("final color: \(UIColor(hexString: "#95A4A5")!.darken(byPercentage: CGFloat(x) / CGFloat(10))!.hexValue())")
    }
    

    i get this output:

    10.0% final color: #7D8A8B 20.0% final color: #667172 30.0% final color: #4F5758 40.0% final color: #383E3F 50.0% final color: #212525 60.0% final color: #0A0B0C 70.0% final color: #FFFFFFF4FFFFFFF3FFFFFFF3 80.0% final color: #FFFFFFDDFFFFFFDAFFFFFFDA 90.0% final color: #FFFFFFC6FFFFFFC0FFFFFFC0 100.0% final color: #FFFFFFAFFFFFFFA7FFFFFFA7

    shouldnt the %100 percentage be equal or less than #FFFFFF?

    opened by franmontaldo 0
  • Enumeration value 'kCGColorSpaceModelXYZ' not handled in switch

    Enumeration value 'kCGColorSpaceModelXYZ' not handled in switch

    Get this error in XCode 11.5: Enumeration value 'kCGColorSpaceModelXYZ' not handled in switch

    You can fix it by adding the missing case at line 936 in UIColor+Chameleon.m as follows: case kCGColorSpaceModelXYZ:

    in order to handle it as one of the Unsupported color models.

    (BTW this is great error checking by Swift/XCode.)

    opened by mepster 0
  • Library not loaded

    Library not loaded

    Hi, I am trying to make a build of my app on my own device, but it crashes all the time. Error states that this library is not loaded. It doesn't matter whether I put into "Link binary with libraries" or not.

    Do you have any ideas where I am wrong?

    P.s. it is my first build and probably the solutions is obvious for you, but not me yet.

    opened by golgitab 0
Releases(2.2.0)
  • 2.1.0(Jan 25, 2016)

    2-1-0

    What's New

    • Retrieve the hexValue for any UIColor object (Works similarly to stringValue and floatValue). • Generate a random flat color while specifying an array of flat colors to exclude • Randomly assign a color (flat / non-flat) from a specified array of colors.

    Note: Check out the guide for a quick look on who to use these new methods.
    1. Guide | Hex Values
    2. Guide | Choosing A Random Flat Color But Excluding A Few
    3. Guide | Choosing A Random Color From a List of Colors

    Bug Fixes

    • Fixed issue where UIStatusBarStyle was forcing the default look even when Chameleon was not being explicitly used to control the status bar look. (#95).

    Source code(tar.gz)
    Source code(zip)
    Chameleon.framework.zip(2.54 MB)
  • 2.0.6(Nov 30, 2015)

    2-0-6

    Changes

    • Fixed issue where colorsFromImage was creating a new image every time instead of using the one sent via parameter , when using Chameleon Shorthand in Swift. (#89)

    Source code(tar.gz)
    Source code(zip)
  • 2.0.5(Nov 26, 2015)

    2.0.5

    What's New

    • Theme Support for UIImagePickerController (#83) • Objective-C Demo Project

    Changes

    • Fixed Erroneous Swift Method Naming Convention Warnings • Bumped up the minimum version of iOS to 8.0. • Fixed If-Else Statement Logic (#48) • Removed cast for calloc (#76).

    Source code(tar.gz)
    Source code(zip)
  • 2.0.4(Oct 9, 2015)

  • 2.0.3(Oct 2, 2015)

    2-0-3

    What's New

    • Added hidesNavigationBarHairline boolean, and by default it is now set to NO. (#64)
    • Improved Quick-Look Documentation for Theme Methods

    Navigation Bar Hairline

    No Hairline

    As of 2.0.3 the navigation bar hairline view is no longer hidden by default. However, if you're seeking a true flat look (like the image above), you can hide the hairline at the bottom of the navigation bar by doing the following:

    Objective-C
    [self.navigationController setHidesNavigationBarHairline:YES];
    
    //or
    
    self.navigationController.hidesNavigationBarHairline = YES;
    

    Changes

    UINavigationController+Chameleon.h

    • @property (nonatomic, assign) BOOL hidesNavigationBarHairline;
    Source code(tar.gz)
    Source code(zip)
  • 2.0.2.2(Sep 27, 2015)

  • 2.0.2.1(Sep 27, 2015)

  • 2.0.2(Sep 27, 2015)

    • Carthage support added. (By @bre7)
    • Demo project added. (By @bre7)
    • Shields added to README. (By @bre7)
    • Fixed 'Wrong Navigation Bar Color' bug. (#51) (By @bre7)
    • Fixed 'Flatten' bug. (#53) (By @bre7)
    • Fixed 'EXC_BAD_ACCESS Error' issue. (#57) (By @bre7)
    • Several swift functions were made public. (By @dexter505)
    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Jun 1, 2015)

    • Fixed cocoapods installation error #30.
    • Updated Swift syntax to Swift 1.2 (Fixed by @peacemoon).
    • Split Objective-C & Swift Files into separate folders to keep files better organized.
    • Renamed Constants.swift to ChameleonShorthand.swift
    Deprecated Methods
    • ~~ColorScheme(colorSchemeType: ColorScheme, color: UIColor, isFlatScheme: Bool)~~
    • Replaced with: ColorSchemeOf(colorSchemeType: ColorScheme, color: UIColor, isFlatScheme: Bool) due to naming constraints.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.3(Jun 1, 2015)

    • Chameleon shorthand is now supported in Swift. (Thanks to @bre7).
    • Fixed Small Syntax Typo. (Fixed by @ddwang).
    • Fixed issue where -colorWithRandomFlatColorOfShadeStyle always returns random color of UIShadeStyleLight (Fixed by @smokyonion).
    • UIGraphics context now uses the current screen's scale, preventing pixel wrap around for certain UIColors generated by + (UIColor *)colorWithGradientStyle methods (Fixed by @alist).
    • Removed warnings regarding the absolute value function fabsf (Fixed by @jherran).
    • Fixed the _UIColor+Chameleon.m:444:13: code will never be executed_, error state (Fixed by @jherran).
    Source code(tar.gz)
    Source code(zip)
  • 1.1.2(Jun 1, 2015)

    • Updated Copyright in all files and launch images
    • Added Launch Image in example project for iPhone 6 & iPhone 6 Plus
    • Replaced the reserved word for with the word with in arrayOfColorsWithColorScheme (Fixed by @sfader).
    Deprecated Methods
    • ~~initWithArray:for:flatScheme:~~

    Replaced with: initWithArray:with:flatScheme:

    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Jun 1, 2015)

    • ShadeStyle is now UIShadeStyle
    • GradientStyle is now UIGradientStyle
    • light is now UIShadeStyleLight
    • dark is now UIShadeStyleDark
    • linearGradientLeftToRight is now UIGradientStyleLeftToRight
    • linearGradientTopToBottom is now UIGradientStyleTopToBottom
    • Added: UIGradientStyleRadial
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Jun 1, 2015)

    • Added Gradient Colors
    • Added Storyboard Palette Add-on
    • Added Xcode Quick Help Documentation Support
    • Switched from RGB colorspace to HSB & LAB colorspaces (closer to human perception)
    • Implemented ContrastingColor which supports all alphas and has additional support for non-flat and flat colors
    • Changed Color difference algorithm so that it now uses CIE:2000 formula
    • Changed RandomFlatColors from enum to nsarray values
    • Edited RandomFlatColor so that it will no longer spit out the same color back to back
    • Switched complementary and triadic fourth and fifth colors order.
    • New Macro: ClearColor
    Deprecated Methods
    • ~~colorWithContrastingBlackOrWhiteColorOn:~~

    Replaced with: colorWithContrastingBlackOrWhiteColorOn:isFlat:

    Deprecated Macros
    • ~~ContrastingColorOf(backgroundColor)~~

    Replaced with: ContrastingColorOf(backgroundColor, isFlat)

    • ~~ComplementaryColorOf(color)~~

    Replaced with: ComplementaryFlatColorOf(color)

    • ~~RandomColorWithShade(shade)~~

    Replaced with: RandomFlatColorWithShade(shade)

    Source code(tar.gz)
    Source code(zip)
Owner
Vicc Alexander
Vicc with 2 c's.
Vicc Alexander
UIGradient - A simple and powerful library for using gradient layer, image, color

UIGradient is now available on CocoaPods. Simply add the following to your project Podfile, and you'll be good to go.

Đinh Quang Hiếu 247 Dec 1, 2022
A beautiful set of predefined colors and a set of color methods to make your iOS/OSX development life easier.

Installation Drag the included Colours.h and Colours.m files into your project. They are located in the top-level directory. You can see a demo of how

Ben Gordon 3.1k Dec 28, 2022
Save the color of your moments. Remember your moments with colors you name.🎨

Pixel Palette ?? What was the color of the sunset yesterday? Or the color you would like to use in your vlog? Save the color of your moments with Pixe

Sue Cho 21 Aug 7, 2022
ColorWheel Test - An attempt at creating a Color Wheel to be utilized for color picking in SwiftUI utlizing various tutuorials on youtube

This code focuses on creating a Color Wheel in which a user will be able to select a desired color to then be implemented in another project that will display that color in an LED connected to an arduino

Gerardo Cerpa 0 Jan 15, 2022
Conical (angular) gradient for iOS written in Swift

AEConicalGradient Conical (angular) gradient in Swift I hope that somebody will find this useful. And nice. Usage AEConicalGradient is a minion which

Marko Tadić 82 Dec 27, 2022
A powerful and easy to use live mesh gradient renderer for iOS.

MeshKit A powerful and easy to use live mesh gradient renderer for iOS. This project wouldn't be possible without the awesome work from Moving Parts a

Ethan Lipnik 51 Jan 1, 2023
Yet another extension to manipulate colors easily in Swift and SwiftUI

DynamicColor provides powerful methods to manipulate colors in an easy way in Swift and SwiftUI. Requirements • Usage • Installation • Contribution •

Yannick Loriot 2.8k Dec 30, 2022
A pure Swift library that allows you to easily convert SwiftUI Colors to Hex String and vice versa.

iOS · macOS · watchOS · tvOS A pure Swift library that allows you to easily convert SwiftUI Colors to Hex String and vice versa. There is also support

Novem 3 Nov 20, 2022
ColorKit makes it easy to find the dominant colors of an image

ColorKit is your companion to work with colors on iOS. Features Installation Sample Project Contributing License Features Dominant Colors Col

Boris Emorine 569 Dec 29, 2022
All wikipedia colors implemented as easy to use UIColor extension 🌈

UIColor-WikiColors All wikipedia colors implemented as an easy to use UIColor extension. Have you ever tried using UIColor.lightBlue just to be welcom

Szymon Maślanka 58 Jul 30, 2022
Manage Colors, Integrate Night/Multiple Themes. (Unmaintained)

Easily integrate and high performance Providing UIKit and CoreAnimation category Read colour customisation from file Support different themes Generate

Draven 3.6k Dec 15, 2022
ChromaColorPicker - An intuitive HSB color picker built in Swift

An intuitive HSB color picker built in Swift. Supports multiple selection handles and is customizable to your needs.

Jonathan Cardasis 536 Dec 29, 2022
HEX color handling as an extension for UIColor. Written in Swift.

SwiftHEXColors HEX color handling as an extension for UIColor. Written in Swift.

Thi Doãn 692 Dec 22, 2022
An attractive color generator for Swift. Ported from randomColor.js.

Random Color Swift Inspired by David Merfield's randomColor.js. It is a ported version to Swift. You can use the library to generate attractive random

Wei Wang 624 Jan 3, 2023
Flat UI color palette helpers written in Swift.

FlatUIColors (swift) install Make sure you have the latest version of CocoaPods (gem install cocoapods) that has Swift support. At the time of this wr

Bryn Bellomy 172 Dec 6, 2022
Google Material Color Palette in Swift

Google Material Color in Swift Defined Google Material Color value ready to use in Swift refer to Google Material Design in Style/Color section ###How

Todsaporn Banjerdkit 48 Oct 30, 2019
A Lightweight But Powerful Color Kit (Swift)

BCColor A lightweight but powerful color kit (Swift) Features Pick Colors From Image Generate Monochrome Image Support Hex Color Style Lighten / Darke

Xiaobo Zhang 418 Nov 25, 2022
Aesthetic color-scheme generation written in Swift

Lorikeet Lightweight framework for generating visually aesthetic color-schemes in Swift Requirements UIKit Features What can Lorikeet do for you Calcu

Þorvaldur Rúnarsson 31 Jun 21, 2022
SheetyColors is an action sheet styled color picker for iOS

?? Based on UIAlertController: The SheetyColors API is based on UIKit's UIAlertController. Simply add buttons to it as you would for any other Action Sheet by defining UIAlertAction instances. Therefore, it nicely integrates with the look & feel of all other native system dialogs. However, you can also chose to use the color picker it self without an action sheet.

Christoph Wendt 102 Nov 10, 2022