+ def setColor(LinkedHashMap metaData) {
+ def hexColor = metaData.hex
+ def newColor
+ switch (hexColor) {
+ case "#0000FF":
+ newColor = "Blue"
+ break;
+ case "#00FF00":
+ newColor = "Green"
+ break;
+ case "#FFFF00":
+ newColor = "Yellow"
+ break;
+ case "#FF6000":
+ newColor = "Orange"
+ break;
+ case "#BF7FBF":
+ newColor = "Purple"
+ break;
+ case "#FF5F5F":
+ newColor = "Pink"
+ break;
+ case "#FF0000":
+ newColor = "Red"
+ break;
+ default:
+ newColor = "Blue"
+ break;
+ }
+ if (newColor != this.color) {
+ this.currentColor = newColor
+ this.color = newColor
+ colorControls[0].setColor(newColor)
+ if (this.colorChanged) {
+ this.colorChanged = false
+ } else {
+ this.colorChanged = true
+ }
+ }
+ def newLevel = metaData.level
+ def newHue = metaData.hue
+ def newSaturation = metaData.saturation
+ if (newLevel != null) {
+ setLevel(newLevel)
+ }
+ if (newHue != null) {
+ setHue(newHue)
+ }
+ if (newSaturation != null) {
+ setSaturation(newSaturation)
+ }
+ }
+