I'm still on this weird "retro thing" too!

Colour Your World

…and your app, too. Because why not?

// Swift 2view.backgroundColor = .redColor()// Swift 3view.backgroundColor = .red // Swift3 removes the need to keep writing "color" every which way from Sunday, woo!
let red = UIColor(red: 255.0/255.0, green: 0.0/255.0, blue: 0.0/255.0, alpha: 1.0) // ew!
view.backgroundColor = red // but still, boom!!
// Surprise!struct Colors {
let mainBlue = UIColor(red: 0.0/255.0, green: 0.0/255.0, blue: 255.0/255.0) // A very bold blue!
let darkerBlue = UIColor(red: 0.0/255.0, green: 0.0/255.0, blue: 166.0/255.0) // 65% darker very bold blue!
}

Hue, Saturation and Brightness! Oh my!

Breakpoint

// Darkening
view.backgroundColor = UIColor.cyanColor().adjust(.Brightness, 30.0)
// The resulting Cyan will be 30% the brightness of normal Cyan
// Hue Rotation
view.backgroundColor = UIColor.redColor().adjust(.Hue, 270.0)
// The Red will be rotated 270degrees, which will result in Purple.
// Saturation
view.backgroundColor = UIColor.cyanColor().adjust(.Saturation, 10.0)
// The Cyan will be 10% of its normal saturation, so almost grey.
view.backgroundColor = UIColor(red: 255.0/255.0, green: 0.0/255.0, blue: 153.0/255.0).adjust(.Hue, 270.0) // Awful!

A Little Bit Of Hex

#ff0072 // Deep Pink

Breakpoint

#ff0096 // Hot Pink!
0xFF0096 
-------- AND
0xFF0000
0xFF0000
0x0000FF
// Pink
view.backgroundColor = UIColor(0xff0096)
// And create a Periwinkle companion colour!
view.backgroundColor = UIColor(0xff0096).adjust(.Hue, 300)

Where To Go From Here?

Rotating the hue of a colour is a way of finding matching colours, when making your own colour palette.

About Us

Aussie iOS Engineer based in Tokyo, Japan | 日英可

Aussie iOS Engineer based in Tokyo, Japan | 日英可