Latest 1.0.3
Homepage https://github.com/william205/WSColourSchemeSwift
License MIT
Platforms ios 8.0
Authors

Easy to use colour schemes and colour manipulation in Swift.

GitHub issues
GitHub forks
GitHub stars
GitHub license
[CocoaPods]()
[CocoaPods]()
[CocoaPods]()
[CocoaPods]()
[CocoaPods]()
Twitter

Colour Schemes

Dark Sea (WSCSchemeDarkSea)

DarkSea
DarkSea
DarkSea
DarkSea
DarkSea

Earth (WSCSchemeEarth)

Earth
Earth
Earth
Earth
Earth

Malachite (WSCSchemeMalachite)

Malachite
Malachite
Malachite
Malachite
Malachite

 Aquamarine (WSCSchemeAquamarine)

Aquamarine
Aquamarine
Aquamarine
Aquamarine
Aquamarine

Tangelo (WSCSchemeTangelo)

Tangelo
Tangelo
Tangelo
Tangelo
Tangelo

Amaranth (WSCSchemeAmaranth)

Tangelo
Tangelo
Tangelo
Tangelo
Tangelo

Paradise (WSCSchemeParadise)

Paradise
Paradise
Paradise
Paradise
Paradise

 Sunglow (WSCSchemeSunglow)

Sunglow
Sunglow
Sunglow
Sunglow
Sunglow

 Cerulean (WSCSchemeCerulean)

Cerulean
Cerulean
Cerulean
Cerulean
Cerulean

 Eucalyptus (WSCSchemeEucalyptus)

Eucalyptus
Eucalyptus
Eucalyptus
Eucalyptus
Eucalyptus

 Desire (WSCSchemeDesire)

Desire
Desire
Desire
Desire
Desire

 Sea (WSCSchemeSea)

Sea
Sea
Sea
Sea
Sea

 Regalia (WSCSchemeRegalia)

Regalia
Regalia
Regalia
Regalia
Regalia

Vivid Sky (WSCSchemeVividSky)

VividSky
VividSky
VividSky
VividSky
VividSky

Lagoon (WSCSchemeLagoon)

Lagoon
Lagoon
Lagoon
Lagoon
Lagoon

Azureish (WSCSchemeAzureish)

Azureish
Azureish
Azureish
Azureish
Azureish

 Surf (WSCSchemeSurf)

Surf
Surf
Surf
Surf
Surf

Waterspout (WSCSchemeWaterspout)

Waterspout
Waterspout
Waterspout
Waterspout
Waterspout

Chestnut (WSCSchemeChestnut)

Chestnut
Chestnut
Chestnut
Chestnut
Chestnut

Pastel (WSCSchemePastel)

Pastel
Pastel
Pastel
Pastel
Pastel

Picton (WSCSchemePicton)

Picton
Picton
Picton
Picton
Picton

Sienna (WSCSchemeSienna)

Sienna
Sienna
Sienna
Sienna
Sienna

Licorice (WSCSchemeLicorice)

Licorice
Licorice
Licorice
Licorice
Licorice

Cardinal (WSCSchemeCardinal)

Cardinal
Cardinal
Cardinal
Cardinal
Cardinal

 Lazuli (WSCSchemeLazuli)

Lazuli
Lazuli
Lazuli
Lazuli
Lazuli

Isabelline (WSCSchemeIsabelline)

Isabelline
Isabelline
Isabelline
Isabelline
Isabelline

Russet (WSCSchemeRusset)

Russet
Russet
Russet
Russet
Russet

 Bistre (WSCSchemeBistre)

Bistre
Bistre
Bistre
Bistre
Bistre

Tuscany (WSCSchemeTuscany)

Tuscany
Tuscany
Tuscany
Tuscany
Tuscany

Blossom (WSCSchemeBlossom)

Blossom
Blossom
Blossom
Blossom
Blossom

Tea (WSCSchemeTea)

Tea
Tea
Tea
Tea
Tea

Jelly Bean (WSCSchemeJellyBean)

JellyBean
JellyBean
JellyBean
JellyBean
JellyBean

 Weldon (WSCSchemeWeldon)

Weldon
Weldon
Weldon
Weldon
Weldon

Periwinkle (WSCSchemePeriwinkle)

Periwinkle
Periwinkle
Periwinkle
Periwinkle
Periwinkle

Tulip (WSCSchemeTulip)

Tulip
Tulip
Tulip
Tulip
Tulip

Blue Bell (WSCSchemeBlueBell)

BlueBell
BlueBell
BlueBell
BlueBell
BlueBell

 Ochre (WSCSchemeOchre)

Ochre
Ochre
Ochre
Ochre
Ochre

 Moon Stone (WSCSchemeMoonStone)

MoonStone
MoonStone
MoonStone
MoonStone
MoonStone

Whites (WSCSchemeWhites)

Whites
Whites
Whites
Whites
Whites

 Midnight (WSCSchemeMidnight)

Midnight
Midnight
Midnight
Midnight
Midnight

Installation

Via CocoaPods

pod 'WSColourScheme'

The pod is currently not working, I am working to get this fixed asap.

Via Download

Download the source files by either cloning the repository or downloading a ZIP of its contents, once downloaded move the WSColourScheme.swift file into your project.

How To Use

You access the properties and methods of the WSColourScheme class in the following way:

WSColourScheme.sharedInstance.property
WSColourScheme.sharedInstance.method()

If you are accessing multiple properties or calling multiple methods then you can store the instance in a variable like so.

let wscs = WSColourScheme.sharedInstance

wscs.property
wscs.method()

 Setting the colour scheme

WSColourScheme.sharedInstance.colourScheme = WSCSchemeDarkSea

Setting a custom colour scheme

You must set five colours for a custom colour scheme.

let colourArray = Array<String>(arrayLiteral: "170,57,57","170,108,57","64,127,127","45,136,45","212,106,106")

WSColourScheme.sharedInstance.customColours = colourArray

Application Wide Colour Scheme

You can set the colour scheme in your AppDelegate.swift inside the func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool method.

Using Colours

Each colour in a scheme is identified as a WSCSColour, there are five identifiers because there are five colours in each scheme.

WSCSColourOne //First colour in the scheme
WSCSColourTwo //Second colour in the scheme
WSCSColourThree //Third colour in the scheme
WSCSColourFour //Fourth colour in the scheme
WSCSColourFive //Fifth colour in the scheme

There are two methods for getting a colour. The first getColour(colour: WSCSColour) gets the specified colour with an alpha of 1, the second getColour(colour: WSCSColour, alpha: CGFloat) gets the specified colour with an alpha value of your choosing.

For example:

myView1.backgroundColor = WSColourScheme.sharedInstance.getColour(colour: WSCSColourOne)

myView2.backgroundColor = WSColourScheme.sharedInstance.getColour(colour: WSCSColourOne, alpha: 0.5)

Making A Colour Lighter/Darker

Using WSColourScheme you can make colours lighter and darker, all you need to do is pass a UIColor and a percentage to the adjustBrightness(colour: UIColor, percentage: CGFloat) method.

//Lighter
myColourOne = WSColourScheme.sharedInstance.adjustBrightness(colour: myColourOne, percentage: 0.4)

//Darker
myColourTwo = WSColourScheme.sharedInstance.adjustBrightness(colour: myColourTwo, percentage: -0.7)

The percentage must be between -1 and +1, negative numbers will make the colour darker and positive numbers will make it brighter.

Colour Manipulation

Each adjustment is identified as a WSCSAdjust, there are five adjustments that you can make:

WSCSAdjustSaturated
WSCSAdjustDesaturated
WSCSAdjustGreyscale
WSCSAdjustComplement
WSCSAdjustInvert

To use these all you need to is pass a UIColor and a WSCSAdjust value to the adjustColour(colour: UIColor, adjustment: WSCSAdjust) method.

//Saturated
myColourOne = WSColourScheme.sharedInstance.adjustColour(colour: myColourOne, adjustment: WSCSAdjustSaturated)

//Desaturated
myColourTwo = WSColourScheme.sharedInstance.adjustColour(colour: myColourTwo, adjustment: WSCSAdjustDesaturated)

//Greyscale
myColourThree = WSColourScheme.sharedInstance.adjustColour(colour: myColourThree, adjustment: WSCSAdjustGreyscale)

//Invert
myColourFour = WSColourScheme.sharedInstance.adjustColour(colour: myColourFour, adjustment: WSCSAdjustInvert)

//Complement
myColourFive = WSColourScheme.sharedInstance.adjustColour(colour: myColourFive, adjustment: WSCSAdjustComplement)

Coming Soon

  • Get HEX, CMYK, HSV, HSL, LAB, and NCS values for a UIColor
  • Turn HEX, CMYK, HSV, HSL, LAB, and NCS values into a UIColor

Licence

WSColourScheme is licensed under the MIT license. See License File for more information.

Contact

Visit my website http://www.willswan.com or tweet me @william205

Latest podspec

{
    "name": "WSColourSchemeSwift",
    "version": "1.0.3",
    "summary": "Easy to use colour schemes and colour manipulation in Swift.",
    "description": "WSColourSchemeSwift is an easy to use class that contains beautiful predefined colour schemes as well as the ability to set your own custom colour scheme. It also features colour manipulation tools including, Colour Lighter/Darker Control, Colour Saturation, Colour Desaturation, Colour Greyscale, Colour Complement, and Colour Invert.",
    "homepage": "https://github.com/william205/WSColourSchemeSwift",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Will Swan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/william205/WSColourSchemeSwift.git",
        "tag": "1.0.3"
    },
    "social_media_url": "https://twitter.com/william205",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "WSColourSchemeSwift/Classes/*.swift"
}

Pin It on Pinterest

Share This