Skip to content

Instantly share code, notes, and snippets.

@yannickl
Last active August 29, 2015 14:25
Show Gist options
  • Save yannickl/20c4dc43fcd05e084239 to your computer and use it in GitHub Desktop.
Save yannickl/20c4dc43fcd05e084239 to your computer and use it in GitHub Desktop.
DynamicColor Sample
let adjustHueColor = baseColor.adjustedHueColor(45 / 360)
let complementColor = baseColor.complementColor()
let lighterColor = baseColor.lighterColor()
// equivalent to
// lighterColor = baseColor.lightenColor(0.2)
let darkerColor = baseColor.darkerColor()
// equivalent to
// darkerColor = baseColor.darkenColor(0.2)
let invertColor = baseColor.invertColor()
let mixWithBlueColor = baseColor.mixWithColor(UIColor.blueColor())
// equivalent to
// mixWithBlueColor = baseColor.mixWithColor(UIColor.blueColor(), weight: 0.5)
let mixWithRedColor = baseColor.mixWithColor(UIColor.redColor())
// equivalent to
// mixWithRedColor = baseColor.mixWithColor(UIColor.redColor(), weight: 0.5)
let saturatedColor = baseColor.saturatedColor()
// equivalent to
// saturatedColor = baseColor.saturateColor(0.2)
let desaturatedColor = baseColor.desaturatedColor()
// equivalent to
// desaturatedColor = baseColor.desaturateColor(0.2)
let grayscaleColor = baseColor.grayscaledColor()
let tintColor = baseColor.tintColor()
// equivalent to
// tintColor = baseColor.tintColor(amount: 0.2)
let shadeColor = baseColor.shadeColor()
// equivalent to
// shadeColor = baseColor.shadeColor(amount: 0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment