Latest0.0.1
Homepagehttps://github.com/sozorogami/SackOfRainbows
LicenseMIT
Platformsios 8.0
Authors

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

Installation

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'

Usage

The basics

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

var redGenerator = theColor(red)
redGenerator.next() // returns red
redGenerator.next() // 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)
rainbow.next() // returns red
rainbow.next() // returns orange
rainbow.next() // 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)
tequilaSunrise.next() // returns orange
tequilaSunrise.next() // returns a slightly reddish orange
tequilaSunrise.next() // returns a slightly more reddish orange
// ...

basic

Chaining

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)

batlympics

Repeating

Repeat a fixed number of times with times().

var doubleRainbow = rainbow.times(2)

doublerainbow

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()

alltheway

License

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": "https://github.com/sozorogami/SackOfRainbows",
    "license": "MIT",
    "authors": {
        "Tyler Tape": "[email protected]"
    },
    "social_media_url": "http://twitter.com/sozorogami",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/sozorogami/SackOfRainbows.git",
        "tag": "v0.0.1"
    },
    "source_files": "SackOfRainbows/*.{swift,h}",
    "public_header_files": "SackOfRainbows/*.h"
}

Pin It on Pinterest

Share This