 										NSParagraphStyleAttributeName: textParagraphStyle,
 										NSFontAttributeName: textFont!]
 		
-		let textValue: Int = Int(hueValue * (type == .Color ? 360 : 100))
+		var value: CGFloat = 0;
+		switch type {
+		case .Color:
+			value = hueValue
+			break
+		case .Saturation:
+			value = saturationValue
+			break
+		case .Brightness:
+			value = brightnessValue
+			break
+		case .Alpha:
+			value = alphaValue
+			break
+		}
+		
+		let textValue: Int = Int(value * (type == .Color ? 360 : 100))
 		let text: NSString = "\(textValue)"
 		var textRect = circleRect
 		textRect.origin.y += (textRect.size.height - (textFont?.lineHeight)!) * 0.5

			size.height -= offset
		}
		hueImage = generateHUEImage(size)
	}
	
	func generateHUEImage(size: CGSize) -> UIImage {
		
		var rect = CGRectMake(0, 0, size.width, size.height)
		UIGraphicsBeginImageContextWithOptions(size, false, 0)
		
		UIBezierPath(roundedRect: rect, cornerRadius: 10.0).addClip()
		
		if direction == .Horizontal {
			for var x: Int = 0; x < Int(size.width); ++x {
				
				switch type {
				case .Color:
					UIColor(hue: CGFloat(CGFloat(x) / size.width), saturation: saturationValue, brightness: brightnessValue, alpha: alphaValue).set()
					break
				case .Saturation:
					UIColor(hue: hueValue, saturation: CGFloat(CGFloat(x) / size.width), brightness: brightnessValue, alpha: alphaValue).set()
					break
				case .Brightness:
					UIColor(hue: hueValue, saturation: saturationValue, brightness: CGFloat(CGFloat(x) / size.width), alpha: alphaValue).set()
					break
				case .Alpha:
					UIColor(hue: hueValue, saturation: saturationValue, brightness: brightnessValue, alpha: CGFloat(CGFloat(x) / size.width)).set()
					break
				}
				
				let temp = CGRectMake(CGFloat(x), 0, 1, size.height)
				UIRectFill(temp)
			}
		}
		else {
			for var y: Int = 0; y < Int(size.height); ++y {
				
				switch type {
				case .Color:
					UIColor(hue: CGFloat(CGFloat(y) / size.height), saturation: saturationValue, brightness: brightnessValue, alpha: alphaValue).set()
					break
				case .Saturation:
					UIColor(hue: hueValue, saturation: CGFloat(CGFloat(y) / size.height), brightness: brightnessValue, alpha: alphaValue).set()
					break
				case .Brightness:
					UIColor(hue: hueValue, saturation: saturationValue, brightness: CGFloat(CGFloat(y) / size.height), alpha: alphaValue).set()
					break
				case .Alpha:
					UIColor(hue: hueValue, saturation: saturationValue, brightness: brightnessValue, alpha: CGFloat(CGFloat(y) / size.height)).set()
					break
				}
				
				let temp = CGRectMake(0, CGFloat(y), size.width, 1)
				UIRectFill(temp)
			}
		}
		
		var image: UIImage = UIGraphicsGetImageFromCurrentImageContext()
		UIGraphicsEndImageContext()
		return image
	}
	
	// Drawing

		update()
	}
	
	func generateHUEImage(size: CGSize) -> UIImage {
		
		var rect = CGRectMake(0, 0, size.width, size.height)
		UIGraphicsBeginImageContextWithOptions(size, false, 0)
		
		UIBezierPath(roundedRect: rect, cornerRadius: 10.0).addClip()
		
		if direction == .Horizontal {
			for var x: Int = 0; x < Int(size.width); ++x {
				
				switch type {
				case .Color:
					UIColor(hue: CGFloat(CGFloat(x) / size.width), saturation: saturationValue, brightness: brightnessValue, alpha: alphaValue).set()
					break
				case .Saturation:
					UIColor(hue: hueValue, saturation: CGFloat(CGFloat(x) / size.width), brightness: brightnessValue, alpha: alphaValue).set()
					break
				case .Brightness:
					UIColor(hue: hueValue, saturation: saturationValue, brightness: CGFloat(CGFloat(x) / size.width), alpha: alphaValue).set()
					break
				case .Alpha:
					UIColor(hue: hueValue, saturation: saturationValue, brightness: brightnessValue, alpha: CGFloat(CGFloat(x) / size.width)).set()
					break
				}
				
				let temp = CGRectMake(CGFloat(x), 0, 1, size.height)
				UIRectFill(temp)
			}
		}
		else {
			for var y: Int = 0; y < Int(size.height); ++y {
				
				switch type {
				case .Color:
					UIColor(hue: CGFloat(CGFloat(y) / size.height), saturation: saturationValue, brightness: brightnessValue, alpha: alphaValue).set()
					break
				case .Saturation:
					UIColor(hue: hueValue, saturation: CGFloat(CGFloat(y) / size.height), brightness: brightnessValue, alpha: alphaValue).set()
					break
				case .Brightness:
					UIColor(hue: hueValue, saturation: saturationValue, brightness: CGFloat(CGFloat(y) / size.height), alpha: alphaValue).set()
					break
				case .Alpha:
					UIColor(hue: hueValue, saturation: saturationValue, brightness: brightnessValue, alpha: CGFloat(CGFloat(y) / size.height)).set()
					break
				}
				
				let temp = CGRectMake(0, CGFloat(y), size.width, 1)
				UIRectFill(temp)
			}
		}
		
		var image: UIImage = UIGraphicsGetImageFromCurrentImageContext()
		UIGraphicsEndImageContext()
		return image
	}
	
	func update() {
		let offset = (direction == .Horizontal ? self.frame.size.height : self.frame.size.width)
		var size = self.frame.size
