Translates the slider value into hue, int[0,359]
@method _getH
@protected
@return {int} the hue from 0 to 359
187948
function() {
            var size = this.get(this.OPT.PICKER_SIZE),
                h = (size - this.hueSlider.getValue()) / size;
            h = Math.round(h*360);
            return (h === 360) ? 0 : h;
        }
704246
function spin(color, amount) {
    var hsl = tinycolor(color).toHsl();
    var hue = (hsl.h + amount) % 360;
    hsl.h = hue < 0 ? 360 + hue : hue;
    return tinycolor(hsl);
}
769464
private JSlider getSliderMaxDepth() {
		if (sliderMaxDepth == null) {
			sliderMaxDepth = new JSlider();
			sliderMaxDepth.setMaximum(19);
			sliderMaxDepth.setMinimum(0);
			sliderMaxDepth.setMinorTickSpacing(1);
			sliderMaxDepth.setPaintTicks(true);
			sliderMaxDepth.setPaintLabels(true);
			sliderMaxDepth.setName("");
			sliderMaxDepth.setMajorTickSpacing(1);
			sliderMaxDepth.setSnapToTicks(true);
			sliderMaxDepth.setPaintTrack(true);
		}
		return sliderMaxDepth;
	}
263698
function (position, callback) {
      var pixelOffset = this._calcOffsetFromPosition(position);
      var closestIndex = this._getClosestIndex(pixelOffset);
      var nextValue = this._trimAlignValue(this._calcValue(pixelOffset));

      var value = this.state.value.slice(); // Clone this.state.value since we'll modify it temporarily
      value[closestIndex] = nextValue;

      // Prevents the slider from shrinking below `props.minDistance`
      for (var i = 0; i < value.length - 1; i += 1) {
        if (value[i + 1] - value[i] < this.props.minDistance) return;
      }

      this.setState({value: value}, callback.bind(this, closestIndex));
    }
662950
function () {
            var o = this.options,
                c = this.$cache,

                is_from_min = typeof o.from_min === "number" && !isNaN(o.from_min),
                is_from_max = typeof o.from_max === "number" && !isNaN(o.from_max),
                is_to_min = typeof o.to_min === "number" && !isNaN(o.to_min),
                is_to_max = typeof o.to_max === "number" && !isNaN(o.to_max),

                from_min,
                from_max,
                to_min,
                to_max;

            if (o.type === "single") {
                if (o.from_shadow && (is_from_min || is_from_max)) {
                    from_min = this.convertToPercent(is_from_min ? o.from_min : o.min);
                    from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min;
                    from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min));
                    from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max));
                    from_min = from_min + (this.coords.p_handle / 2);

                    c.shad_single[0].style.display = "block";
                    c.shad_single[0].style.left = from_min + "%";
                    c.shad_single[0].style.width = from_max + "%";
                } else {
                    c.shad_single[0].style.display = "none";
                }
            } else {
                if (o.from_shadow && (is_from_min || is_from_max)) {
                    from_min = this.convertToPercent(is_from_min ? o.from_min : o.min);
                    from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min;
                    from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min));
                    from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max));
                    from_min = from_min + (this.coords.p_handle / 2);

                    c.shad_from[0].style.display = "block";
                    c.shad_from[0].style.left = from_min + "%";
                    c.shad_from[0].style.width = from_max + "%";
                } else {
                    c.shad_from[0].style.display = "none";
                }

                if (o.to_shadow && (is_to_min || is_to_max)) {
                    to_min = this.convertToPercent(is_to_min ? o.to_min : o.min);
                    to_max = this.convertToPercent(is_to_max ? o.to_max : o.max) - to_min;
                    to_min = this.toFixed(to_min - (this.coords.p_handle / 100 * to_min));
                    to_max = this.toFixed(to_max - (this.coords.p_handle / 100 * to_max));
                    to_min = to_min + (this.coords.p_handle / 2);

                    c.shad_to[0].style.display = "block";
                    c.shad_to[0].style.left = to_min + "%";
                    c.shad_to[0].style.width = to_max + "%";
                } else {
                    c.shad_to[0].style.display = "none";
                }
            }
        }
1327164
public static int fromHSL(float h, float s, float l, int a) {
        int r, g, b;

        if (s == 0) {
            r = g = b = (int) (l * MAX);
        } else {
            float v1, v2;
            float hue = h / 360f;

            v2 = (l < 0.5) ? (l * (1 + s)) : ((l + s) - (l * s));
            v1 = 2 * l - v2;

            r = (int) (MAX * HueToRGB(v1, v2, hue + (1.0f / 3)));
            g = (int) (MAX * HueToRGB(v1, v2, hue));
            b = (int) (MAX * HueToRGB(v1, v2, hue - (1.0f / 3)));
        }

        return getARGB(r, g, b, a);
    }
233073
function () {
            var ID = this.ID,
                size = this.get(this.OPT.PICKER_SIZE);

            this.logger.log("picker size" + size);

            this.hueSlider = Slider.getVertSlider(
                this.getElement(ID.HUE_BG), 
                this.getElement(ID.HUE_THUMB), 0, size);

            this.pickerSlider = Slider.getSliderRegion(
                this.getElement(ID.PICKER_BG), 
                this.getElement(ID.PICKER_THUMB), 0, size, 0, size);

            // Apply animate attribute configuration
            this.set(this.OPT.ANIMATE, this.get(this.OPT.ANIMATE));
        }
168778
def rgb_to_ryb(hue):
  
  d = hue % 15
  i = int(hue / 15)
  x0 = _RybWheel[i]
  x1 = _RybWheel[i+1]
  return x0 + (x1-x0) * d / 15
581524
function(){
		var r = 0,
			g = 0,
			b = 0,
			a = 0;

		this.each(function(c){
			r += c.rgb[0];
			g += c.rgb[1];
			b += c.rgb[2];
			a += c.alpha();
		});

		var num = this.colors.length;
		if(num > 0){
			return TColor.newRGBA(r / num, g / num, b / num, a / num);
		}
		return undefined;
	}
1095030
function(){
        var hsv = this.hsv;

        //hue is 0 - 360
        var h = Math.floor(hsv[0] * 360);
        //saturation & value/luminosity is 0-100 (%)
        var s = Math.floor(hsv[1] * 100);
        var v = Math.floor(hsv[2] * 100);
		return "hsl(" +h+ "," +s+ "%," +v+ "%)";
	}
110299
function(newOffset) {
            this.logger.log("hue update: " + newOffset , "warn");

            var h        = this._getH(),
                rgb      = Color.hsv2rgb(h, 1, 1),
                styleDef = "rgb(" + rgb.join(",") + ")";

            this.set(this.OPT.HUE, h, true);

            // set picker background to the hue
            Dom.setStyle(this.getElement(this.ID.PICKER_BG), "background-color", styleDef);

            if (this.hueSlider.valueChangeSource !== Slider.SOURCE_SET_VALUE) {
                this._getValuesFromSliders();
            }

            this._updateFormFields();
            this._updateSwatch();
        }
56650
def _hue(color, **kwargs):
    
    h = colorsys.rgb_to_hls(*[x / 255.0 for x in color.value[:3]])[0]
    return NumberValue(h * 360.0)
983745
function hslToRgb(h, s, l, a, out) {
		function hueToRgb(m1, m2, h) {
			h = h % 1;
			if (h < 0) {
				h += 1;
			}
			if (h < 1 / 6) {
				return m1 + (m2 - m1) * h * 6;
			}
			if (h < 1 / 2) {
				return m2;
			}
			if (h < 2 / 3) {
				return m1 + (m2 - m1) * (2/3 - h) * 6;
			}
			return m1;
		}

		var m1, m2;
		if (l < 0.5) {
			m2 = l * (s + 1);
		} else {
			m2 = l + s - l * s;
		}
		m1 = l * 2 - m2;

		if (!out) {
			out = [];
		}

		out[0] = hueToRgb(m1, m2, h + 1/3);
		out[1] = hueToRgb(m1, m2, h);
		out[2] = hueToRgb(m1, m2, h - 1/3);
		out[3] = a;

		return out;
	}
1326083
function setBrightnessOfLed(callback) {
    var ledIndex = 8;
    
    var setBrightnessOfLedInterval = setInterval(function() {
        if (ledIndex >= 0) {
            dot3k.barGraph.setBrightnessOfLed(ledIndex, 0);
            
            ledIndex--;
        } else {
            clearInterval(setBrightnessOfLedInterval);
            
            if (callback) {
                callback();
            }
        }
    }, 500);
}
673855
function() {
           
            var hex = this.get(this.OPT.HEX),
                l   = hex.length,
                c,i,rgb;

            // support #369 -> #336699 shorthand
            if (l === 3) {
                c = hex.split("");
                for (i=0; i<l; i=i+1) {
                    c[i] = c[i] + c[i];
                }

                hex = c.join("");
            }

            if (hex.length !== 6) {
                return false;
            }

            rgb = Color.hex2rgb(hex);


            this.setValue(rgb);
        }
96600
function () {

			var low, high;

			if ( this.littleEndian ) {

				low = this.getUint32();
				high = this.getUint32();

			} else {

				high = this.getUint32();
				low = this.getUint32();

			}

			return high * 0x100000000 + low;

		}
109165
function hslToRgb(h, s, l) {

  h /= 360;
  s /= 100;
  l /= 100;

  var r, g, b;

  if (s === 0) {
    r = g = b = l; // achromatic
  } else {
    var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
    var p = 2 * l - q;
    r = hueToRgb(p, q, h + 1 / 3);
    g = hueToRgb(p, q, h);
    b = hueToRgb(p, q, h - 1 / 3);
  }

  return ({
    r: r * 255,
    g: g * 255,
    b: b * 255
  });
}