Skip to content

Instantly share code, notes, and snippets.

@aronbalog
Created May 3, 2018 22:53
Show Gist options
  • Save aronbalog/445896de134ccf67c4031e448308eecc to your computer and use it in GitHub Desktop.
Save aronbalog/445896de134ccf67c4031e448308eecc to your computer and use it in GitHub Desktop.
import UIKit
import CoreNavigation
import ChromaColorPicker
class ColorViewController: UIViewController {
lazy var colorPicker: ChromaColorPicker = {
let view = ChromaColorPicker(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
view.padding = 5
view.stroke = 3
view.hexLabel.textColor = UIColor.black
view.delegate = self
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(colorPicker)
colorPicker.center = view.center
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
colorPicker.adjustToColor(view.backgroundColor ?? .black)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment