     }
     
     func settingsPopover(_ settingsPopover: SettingsPopover, didSelectIndex index: Int) {
-        setBackgroundColor(colorAtIndex(index))
+        selectColorAtIndex(index)
     }
 }
 

    static let numColors = 16
    static let numColumns = 4
    
    @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;
        
        self.view.addSubview(popover)
        
        // XXX remove hardcoded width and height
        self.view.addConstraint(NSLayoutConstraint(item:popover, attribute:.width, relatedBy:.equal, toItem:nil, attribute:.notAnAttribute, multiplier:1.0, constant:222))
        self.view.addConstraint(NSLayoutConstraint(item:popover, attribute:.height, relatedBy:.equal, toItem:nil, attribute:.notAnAttribute, 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))
        
