Created
November 19, 2017 19:17
-
-
Save kidcodely/6867ac1b667a3db8ce03d36edb0b22ab to your computer and use it in GitHub Desktop.
Colours from images (Chameleon)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import ChameleonFramework | |
class RootViewController: UIViewController { | |
@IBOutlet var myImage: UIImageView! | |
@IBOutlet var myTitle: UILabel! | |
@IBOutlet var myDescription: UITextView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
myDescription.clipsToBounds = true | |
myDescription.layer.cornerRadius = 10.0 | |
view.backgroundColor = ColorsFromImage(image: myImage.image!, withFlatScheme: false)[1] | |
myDescription.backgroundColor = ContrastColorOf(backgroundColor: view.backgroundColor!, returnFlat: false) | |
myDescription.textColor = ContrastColorOf(backgroundColor: myDescription.backgroundColor!, returnFlat: false) | |
myTitle.textColor = ContrastColorOf(backgroundColor: view.backgroundColor!, returnFlat: false) | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment