Platformsios 8.0

SackOfRainbows provides an expressive syntax for creating color generators. Chain generators in serial or parallel to easily produce gradients and complex patterns.


SackOfRainbows is written in Swift 2.0 and requires Xcode 7.

Via Cocoapods

Add the following line to your Podfile and run pod install.

pod 'SackOfRainbows'


The basics

To make a single color, use theColor(). All your favorite UIColors have been aliased for easy use.

var redGenerator = theColor(red) // returns red // returns nil

You can generate a bunch of colors in order using theColors() like so:

var rainbow = theColors(red, orange, yellow, green, blue,
    UIColor(red: 0.29, green: 0.0, blue: 0.51, alpha: 1), purple) // returns red // returns orange // returns yellow
// ...

Making a series of colors in a gradient is easy as well. Just indicate the start color, end color, and how many steps start to finish.

var tequilaSunrise = gradient().from(orange).to(red).steps(10) // returns orange // returns a slightly reddish orange // returns a slightly more reddish orange
// ...



To chain generators in sequence, use then().

let batman = theColors(blue, black)
let robin = theColors(yellow, green, red)
var batmanAndRobin = batman.then(robin)

To chain in parallel, use alternate().

var olympics = alternate(batman, robin)



Repeat a fixed number of times with times().

var doubleRainbow = rainbow.times(2)


To enter a world of endless color, use forever().

let blueToWhite = gradient().from(blue).to(white).steps(10)
let whiteToBlue = gradient().from(white).to(blue).steps(10)
var allTheWayAcrossTheSky = blueToWhite.then(whiteToBlue).forever()



SackOfRainbows is released under the MIT License.

Latest podspec

    "name": "SackOfRainbows",
    "version": "0.0.1",
    "summary": "A handy color generator with a fun interface.",
    "description": "                   SackOfRainbows provides an expressive syntax to create color generators. Chain generators in serial or parallel to easily create gradients and complex patterns.n",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Tyler Tape": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "v0.0.1"
    "source_files": "SackOfRainbows/*.{swift,h}",
    "public_header_files": "SackOfRainbows/*.h"

Pin It on Pinterest

Share This