Latest 1.0.0
License MIT
Platforms ios 8.0, requires ARC

Mixer Build Status Carthage compatible

Centralize your color definitions in a CSV file & easily share them for people to edit.


Via Carthage:

Add the following your Cartfile:

For Swift 3:

github "ios-studio/Mixer" ~> 1.0.0

For Swift 2.x:

github "ios-studio/Mixer" ~> 0.1.2

Via CocoaPods:

Add the following your Podfile:

For Swift 3:

pod "Mixer", "~> 1.0.0"

For Swift 2.x:

pod "Mixer", "~> 0.1.2"

Default Setup

Mixer will look for a file named Colors.csv in the specified bundle or at the specified path. The contents of the file should look like this. It is important to keep the headers as shown, otherwise Mixer will not be able to read the file.

For the colors you’d like to use in your project, define a class which conforms to the protocol MixerColor. The only requirement of that protocol is that the object responds to the property name, so for example it could look like:

enum Color: String, MixerColor {
    case Blue = "Blue"
    case Red = "Red"

    var name: String { return rawValue }

Where "Blue" corresponds to the name of a color in the csv file.


Mixer can be passed a MixerConfiguration object where you can specify another path to your colors file.

Using Mixer

Pass the bundle to initialize. Mixer will look up the Colors file in the bundle and cache it for subsequent initializations in the same process:

let bundle = Bundle(forClass: self.dynamicType)
let mixer = Mixer(bundle: bundle)

Typically, all you will then use is the colorFor method, which you can use in two ways:

Using your color definition

Remember the definition of Color from above? This is how to get a color according to your definitions:

let color = mixer.colorFor(Color.Blue)

Using a string

This is a convenience method to be able to use Mixer with @IBDesignable / @IBInspectable. Since @IBInspectable does not yet work with enum types, you can use the version of colorFor without a type check like so:

let color = mixer.colorFor("Blue")

For an example involving @IBDesignable, go to the wiki


Yes please!

Latest podspec

    "name": "Mixer",
    "version": "1.0.0",
    "summary": "A tiny library helping to centralize color definitions",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Beat Richartz": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "Mixer/**/*.swift",
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This