Skip to content

Instantly share code, notes, and snippets.

@clooth
Created October 20, 2015 11:25
Show Gist options
  • Save clooth/ca2476b601d7ccb2f06d to your computer and use it in GitHub Desktop.
Save clooth/ca2476b601d7ccb2f06d to your computer and use it in GitHub Desktop.
let (background, primary, secondary) = image.analyzeColors()
switch background {
case primaryText.isContrasting(background):
self.titleLabel.textColor = primaryText
case secondaryText.isContrasting(background):
self.titleLabel.textColor = secondaryText
default:
self.titleLabel.textColor = background.isDarkColor ? UIColor.whiteColor() : Theme.secondaryColor
}
@iosdevben
Copy link

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment