Get the passed values as CSS HSL color value

@param fHue
Hue - is scaled to 0-359
@param fSaturation
Saturation - is scaled to 0-100
@param fLightness
Lightness - is scaled to 0-100
@return The CSS string to use
348711
@Nonnull
  @Nonempty
  public static String getHSLColorValue (final float fHue, final float fSaturation, final float fLightness)
  {
    return new StringBuilder (18).append (CCSSValue.PREFIX_HSL_OPEN)
                                 .append (getHSLHueValue (fHue))
                                 .append (',')
                                 .append (getHSLPercentageValue (fSaturation))
                                 .append ("%,")
                                 .append (getHSLPercentageValue (fLightness))
                                 .append ("%")
                                 .append (CCSSValue.SUFFIX_HSL_CLOSE)
                                 .toString ();
  }
1008783
def to_hsl(self):
        ''' 

        '''
        from .hsl import HSL # prevent circular import
        h, l, s = colorsys.rgb_to_hls(float(self.r)/255, float(self.g)/255, float(self.b)/255)
        return HSL(round(h*360), s, l, self.a)
936028
private Color buildHSBColor(final HSBColor hsbColor) {
        Color color = null;
        if (hsbColor.opacity() >= 1.0) {
            color = Color.hsb(hsbColor.hue(), hsbColor.saturation(), hsbColor.brightness());
        } else {
            color = Color.hsb(hsbColor.hue(), hsbColor.saturation(), hsbColor.brightness(), hsbColor.opacity());
        }
        return color;
    }
1274596
def flightmode_colour(self, flightmode):
        ''''''
        if flightmode not in self.flightmode_colourmap:
            self.flightmode_colourmap[flightmode] = self.next_flightmode_colour()
        return self.flightmode_colourmap[flightmode]
421695
function (color, angle) {
			var hsl, color0, color2;
			if (!angle) {
				angle = 30;
			}
			hsl = ColorHelper.rgbToHSL(color);
			hsl[0] = (hsl[0] + angle) % 360;
			color0 = ColorHelper.hslToHexColor(hsl);
			color0 = ColorHelper.darken(color0, 8);
			color0 = ColorHelper.saturate(color0, -6);
			hsl = ColorHelper.rgbToHSL(color);
			hsl[0] = (hsl[0] - angle + 360) % 360;
			color2 = ColorHelper.hslToHexColor(hsl);
			return [color0, color, color2];
		}
1183191
private RgbaColor withHsl(int index, float value) {
        float[] HSL = convertToHsl();
        HSL[index] = value;
        return RgbaColor.fromHsl(HSL);
    }
1281919
public static boolean isHSLAColorValue (@Nullable final String sValue)
  {
    final String sRealValue = StringHelper.trim (sValue);
    return StringHelper.hasText (sRealValue) &&
           sRealValue.startsWith (CCSSValue.PREFIX_HSLA) &&
           RegExHelper.stringMatchesPattern (PATTERN_HSLA, sRealValue);
  }
1146869
def getColorHSV(name):
    
    try:
        x = getColorInfoList()[getColorList().index(name.upper())]
    except:
        return (-1, -1, -1)
    
    r = x[1] / 255.
    g = x[2] / 255.
    b = x[3] / 255.
    cmax = max(r, g, b)
    V = round(cmax * 100, 1)
    cmin = min(r, g, b)
    delta = cmax - cmin
    if delta == 0:
        hue = 0
    elif cmax == r:
        hue = 60. * (((g - b)/delta) % 6)
    elif cmax == g:
        hue = 60. * (((b - r)/delta) + 2)
    else:
        hue = 60. * (((r - g)/delta) + 4)
        
    H = int(round(hue))
    
    if cmax == 0:
        sat = 0
    else:
        sat = delta / cmax
    S = int(round(sat  * 100))

    return (H, S, V)
1360375
function(ui)
              {
                switch (settings.color.mode)
                {
                  case 'h':
                    var a = ui.val('a');
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (a || 0)) * 100) / 255, 4));
                    break;
                  case 's':
                    var hva = ui.val('hva'),
                        saturatedColor = new Color({ h: hva && hva.h || 0, s: 100, v: hva != null ? hva.v : 100 });
                    setBG.call($this, colorBarDiv, saturatedColor.val('hex'));
                    setAlpha.call($this, colorBarL2, 100 - (hva != null ? hva.v : 100));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (hva && hva.a || 0)) * 100) / 255, 4));
                    break;
                  case 'v':
                    var hsa = ui.val('hsa'),
                        valueColor = new Color({ h: hsa && hsa.h || 0, s: hsa != null ? hsa.s : 100, v: 100 });
                    setBG.call($this, colorBarDiv, valueColor.val('hex'));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (hsa && hsa.a || 0)) * 100) / 255, 4));
                    break;
                  case 'r':
                  case 'g':
                  case 'b':
                    var hValue = 0, vValue = 0, rgba = ui.val('rgba');
                    if (settings.color.mode == 'r')
                    {
                      hValue = rgba && rgba.b || 0;
                      vValue = rgba && rgba.g || 0;
                    }
                    else if (settings.color.mode == 'g')
                    {
                      hValue = rgba && rgba.b || 0;
                      vValue = rgba && rgba.r || 0;
                    }
                    else if (settings.color.mode == 'b')
                    {
                      hValue = rgba && rgba.r || 0;
                      vValue = rgba && rgba.g || 0;
                    }
                    var middle = vValue > hValue ? hValue : vValue;
                    setAlpha.call($this, colorBarL2, hValue > vValue ? Math.precision(((hValue - vValue) / (255 - vValue)) * 100, 4) : 0);
                    setAlpha.call($this, colorBarL3, vValue > hValue ? Math.precision(((vValue - hValue) / (255 - hValue)) * 100, 4) : 0);
                    setAlpha.call($this, colorBarL4, Math.precision((middle / 255) * 100, 4));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (rgba && rgba.a || 0)) * 100) / 255, 4));
                    break;
                  case 'a':
                    var a = ui.val('a');
                    setBG.call($this, colorBarDiv, ui.val('hex') || '000000');
                    setAlpha.call($this, colorBarL5, a != null ? 0 : 100);
                    setAlpha.call($this, colorBarL6, a != null ? 100 : 0);
                    break;
                }
              }
103022
def hsl_to_rgb(h, s, l)
      h %= 201
      s %= 101
      l %= 101
      if l <= 49
        color_max = 255.0 * (l + l * (s / 100.0)) / 100.0
        color_min = 255.0 * (l - l * (s / 100.0)) / 100.0
      else
        color_max = 255.0 * (l + (100 - l) * (s / 100.0)) / 100.0
        color_min = 255.0 * (l - (100 - l) * (s / 100.0)) / 100.0
      end

      if h < HUE_PER_6
        base = h
      elsif h < HUE_PER_6 * 3
        base = (h - HUE_PER_6 * 2).abs
      elsif h < HUE_PER_6 * 5
        base = (h - HUE_PER_6 * 4).abs
      else
        base = (200 - h)
      end
      base = base / HUE_PER_6 * (color_max - color_min) + color_min

      divide = (h / HUE_PER_6).to_i
      red, green, blue = (case divide
                          when 0 then  [color_max, base, color_min]
                          when 1 then  [base, color_max, color_min]
                          when 2 then  [color_min, color_max, base]
                          when 3 then  [color_min, base, color_max]
                          when 4 then  [base, color_min, color_max]
                          else         [color_max, color_min, base]
                          end)

      [red.round, green.round, blue.round]
    end
957469
function HSVA_TO_RGBA() {
        var h = this.h();
        var s = this.s();
        var v = this.v();
        var a = this.a();
        var hi = Math.floor(h / 60);
        var f = h / 60 - hi;
        var p = v * (1 - s);
        var q = v * (1 - f * s);
        var t = v * (1 - (1 - f) * s);
        var rgba;

        switch (hi) {
            case 0:
                rgba = [v, t, p, a]; break;
            case 1:
                rgba = [q, v, p, a]; break;
            case 2:
                rgba = [p, v, t, a]; break;
            case 3:
                rgba = [p, q, v, a]; break;
            case 4:
                rgba = [t, p, v, a]; break;
            case 5:
                rgba = [v, p, q, a]; break;
            default:
                rgba = [0, 0, 0, a];
        }

        for (var i = rgba.length - 1; i--;) {
            rgba[i] *= 255;
        }

        return kolor.rgba(rgba);
    }
1330851
def set_hsb(self, hue, saturation, brightness=None, *, index=0,
                transition_time=None):
        """"""
        self._value_validate(hue, RANGE_HUE, "Hue")
        self._value_validate(saturation, RANGE_SATURATION, "Saturation")

        values = {
            ATTR_LIGHT_COLOR_SATURATION: saturation,
            ATTR_LIGHT_COLOR_HUE: hue
        }

        if brightness is not None:
            values[ATTR_LIGHT_DIMMER] = brightness
            self._value_validate(brightness, RANGE_BRIGHTNESS, "Brightness")

        if transition_time is not None:
            values[ATTR_TRANSITION_TIME] = transition_time

        return self.set_values(values, index=index)
674546
function() {
        if (this.hsl !== null) {
            if (this.alpha < 1.0) {
                if (this.perceptual) {
                    return 'rgba(' + hsluv.hsluvToRgb([this.hsl[0], this.hsl[1] * 100, this.hsl[2] * 100]).map(function(c) {
                        return Math.round(c * 255);
                    }).concat(this.round(this.alpha, 2)).join(', ') + ')';
                }
                else {
                    return 'rgba(' + chroma.hsl(this.hsl[0], this.hsl[1], this.hsl[2]).rgb().map(function(c) {
                        return Math.round(c);
                    }).concat(this.round(this.alpha, 2)).join(', ') + ')';
                }
            } else {
                if (this.perceptual) {
                    return hsluv.hsluvToHex([this.hsl[0], this.hsl[1] * 100, this.hsl[2] * 100]);
                }
                else {
                    return chroma.hsl(this.hsl[0], this.hsl[1], this.hsl[2]).hex();
                }
            }
        }
        return '';
    }
658628
public static Color rotateHue (Color color, float fraction) {

		float[] af = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);

		float hue = af[0];
		float saturation = af[1];
		float brightness = af[2];

		float hueNew = hue  + fraction;

		Color hsb = Color.getHSBColor(hueNew, saturation, brightness);
		return new Color(hsb.getRed(), hsb.getGreen(), hsb.getBlue(), color.getAlpha());
	}
1004739
function hsl(hue, saturation, lightness){
  if (1 == arguments.length) {
    utils.assertColor(hue, 'color');
    return hue.hsla;
  } else {
    return hsla(
        hue
      , saturation
      , lightness
      , new nodes.Unit(1));
  }
}
905197
public function adjustHue(float $degrees = 30): Color
    {
        if (!Validator::isValidAdjustment($degrees)) {
            throw new ColorException('You must specify a proper value between 360 and -360');
        }

        $colors = $this->getHsl();

        // Convert the hue to degrees and add the adjustment
        $hue = ($colors['h'] * 360) + $degrees;

        if ($hue >= 360) {
            $hue -= 360;
        } elseif ($hue < 0) {
            $hue += 360;
        }

        $adjustedColor = self::hslToRgb($hue / 360, $colors['s'], $colors['l']);

        return new self(...array_values($adjustedColor));
    }
480291
static HSL toHSL( double color ) {
        long argb = Double.doubleToRawLongBits( color );
        double a = alpha( color );
        double r = clamp( ((argb >> 32) & 0xFFFF) / (double)0xFF00 );
        double g = clamp( ((argb >> 16) & 0xFFFF) / (double)0xFF00 );
        double b = clamp( ((argb >> 0) & 0xFFFF) / (double)0xFF00 );

        double max = Math.max( Math.max( r, g ), b );
        double min = Math.min( Math.min( r, g ), b );
        double h, s, l = (max + min) / 2, d = max - min;

        if( max == min ) {
            h = s = 0;
        } else {
            s = l > 0.5 ? d / (2 - max - min) : d / (max + min);

            if( max == r ) {
                h = (g - b) / d + (g < b ? 6 : 0);
            } else if( max == g ) {
                h = (b - r) / d + 2;
            } else {
                h = (r - g) / d + 4;
            }
            h /= 6;
        }
        return new HSL( h * 360, s, l, a );
    }