explaingit

vicc/chameleon

12,335Objective-CAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A color library for iOS apps that makes it easy to pick good-looking color schemes, extract colors from images, and ensure text stays readable on any background color.

Mindmap

mindmap
  root((chameleon))
    What it does
      Color schemes from one color
      Image color extraction
      Contrast text detection
      Gradient in one line
    Tech Stack
      Objective-C
      Swift
      CocoaPods
      Carthage
    Use Cases
      Dynamic UI theming
      Readable text colors
      Photo-matched interfaces
    Audience
      iOS developers
      App designers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Automatically choose whether text should be light or dark based on a dynamic or user-chosen background color.

USE CASE 2

Generate a complementary or triadic color palette from a single brand color for your app UI.

USE CASE 3

Extract the dominant color from a product image and apply it as the navigation bar or background tint.

USE CASE 4

Apply a gradient in one line of code to any button, label, or view background.

Tech stack

Objective-CSwiftCocoaPodsCarthage

Getting it running

Difficulty · easy Time to first run · 5min

Install via CocoaPods or Carthage, requires iOS 7+ and Xcode 6.3 minimum.

Use freely for any purpose including commercial use, as long as you keep the copyright notice.

In plain English

Chameleon is a color library for iOS apps, written in Objective-C with Swift support. Its main purpose is to make it easier for app developers to work with colors without spending time fiddling with raw red/green/blue numbers or struggling to find combinations that look good together. The library offers a curated set of over 24 flat colors in both light and dark variants. Beyond individual colors, it can automatically generate color schemes from a single starting color, producing analogous, complementary, or triadic palettes. This means you pick one color and the library suggests others that work well with it. Two features stand out. First, Chameleon can analyze any color and automatically determine whether text placed on top of it should be light or dark to stay readable. This removes guesswork when users can customize profile colors or when backgrounds vary. Second, it can extract a dominant color or full color scheme from an image, which is useful for matching an interface to a photo or product image. The library also supports gradient colors applied in a single line of code to any view's background, text, or tint. There is an Xcode Storyboard add-on so the Chameleon colors appear in the visual color picker inside the design tool, and palettes can be exported to Photoshop and Sketch. Installation is through CocoaPods or Carthage, the standard iOS dependency managers. The project requires iOS 7 or higher for Objective-C and iOS 8 or higher for Swift, with Xcode 6.3 minimum. It is MIT-licensed and open to contributions.

Copy-paste prompts

Prompt 1
Using the Chameleon iOS library in Swift, show me how to extract the dominant color from a UIImage and set it as the navigation bar tint color.
Prompt 2
How do I use Chameleon's ContrastColorOf function to automatically pick readable white or black text for any dynamic background color in a UITableViewCell?
Prompt 3
Give me Swift code using Chameleon to generate a complementary color scheme from a single hex color and apply it across my app's UI elements.
Prompt 4
How do I add Chameleon to my iOS project via CocoaPods and display one of its flat colors as a UIView background?
Prompt 5
Show me how to apply a Chameleon gradient to a UILabel's text color using a flat UI color scheme.
Open on GitHub → Explain another repo

← vicc on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.