             let color = UIColor(hue: colorHue, saturation: CGFloat(1), brightness: CGFloat(1), alpha: CGFloat(1))
             hueMarkerLayer.backgroundColor = color.cgColor
             colorCenterLayer.backgroundColor = color.cgColor
-        }
     }
 
     func getHueMarkerPosition() -> CGPoint {

        colorCenterLayer.setNeedsDisplay()
        self.layer.addSublayer(colorCenterLayer)
        
        hueGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(handleDragHue))
        hueGestureRecognizer.minimumPressDuration = 0;
        hueGestureRecognizer.delegate = self
        self.addGestureRecognizer(hueGestureRecognizer)
        
        backgroundColor = UIColor.init(red: 39/256, green: 46/256, blue: 65/256, alpha: 1.0)
    }
    
    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
        if ( gestureRecognizer == hueGestureRecognizer )
        {
            let position: CGPoint = gestureRecognizer.location(in: self)
            let distanceSquared: CGFloat = (center.x - position.x) * (center.x - position.x) + (center.y - position.y) * (center.y - position.y)
            return ((radius - thickness) * (radius - thickness) < distanceSquared) && (distanceSquared <= radius * radius)
        }
        return true
    }
    
    func move(_ layer: CALayer, from oldHue: CGFloat, to newHue: CGFloat) {
        let path: CGMutablePath = CGMutablePath()
        let center = CGPoint(x: CGFloat(self.bounds.size.width / 2.0), y: CGFloat(self.bounds.size.height / 2.0))

        if (newHue > oldHue) {
            if (newHue - oldHue < 0.5) {
                path.addArc(center: center, radius: CGFloat(radius), startAngle: -oldHue * 2.0 * .pi, endAngle: -newHue * 2.0 * .pi, clockwise: true, transform: .identity)

    var hueCircleLayer: HueCircleLayer!
    var hueMarkerLayer: CALayer!
    var colorCenterLayer: CALayer!
    var panStarted: Bool = false;
    
    var hueTapGestureRecognizer: UITapGestureRecognizer!
    var huePanGestureRecognizer: UIPanGestureRecognizer!
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder);
