     static let numColors = 16
     static let numColumns = 4
     
+    static let defaultHue = 0
+    static let defaultSaturation = 60
+    static let defaultBrightness = 85
+
+    var hue = defaultHue // 0-360
+    var saturation = defaultSaturation // 0-100
+    var brightness = defaultBrightness // 0-100
+    
     @IBOutlet var settingsButton: UIButton?
-    let saturation = 60 // 0-100
-    let brightness = 85 // 0-100
     
     lazy var settingsPopover : SettingsPopover = {
-        
-        if !self.isViewLoaded {
-            fatalError()
-        }
-        
         let popover = SettingsPopover()
         popover.delegate = self
-        self.view.addSubview(popover)
-        self.settingsPopover = popover
-        
         popover.translatesAutoresizingMaskIntoConstraints = false
         popover.backgroundColor = UIColor.black.withAlphaComponent(0.6)
         popover.alpha = 0.0

        popover.layer.shadowRadius = 4;
        popover.layer.shadowOpacity = 0.4;
        
        // XXX remove hardcoded width and height
        self.view.addConstraint(NSLayoutConstraint(item:popover, attribute:.width, relatedBy:.equal, toItem:nil, attribute:.width, multiplier:1.0, constant:222))
        self.view.addConstraint(NSLayoutConstraint(item:popover, attribute:.height, relatedBy:.equal, toItem:nil, attribute:.height, multiplier:1.0, constant:275))
        self.view.addConstraint(NSLayoutConstraint(item:popover, attribute:.right, relatedBy:.equal, toItem:self.settingsButton, attribute:.left, multiplier:1.0, constant:-6.0))
        self.view.addConstraint(NSLayoutConstraint(item:popover, attribute:.bottom, relatedBy:.equal, toItem:self.settingsButton, attribute:.top, multiplier:1.0, constant:-6.0))
        

    }
    
    func settingsPopover(_ settingsPopover: SettingsPopover, didSelectIndex index: Int) {
        selectColorAtIndex(index)
    }
}

