Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.