code: @Nonnull
    @Nonempty
    public static float [] getRGBAsHSLValue (final int nRed, final int nGreen, final int nBlue)
    {
      // Convert RGB to HSB(=HSL) - brightness vs. lightness
      int cmax = nRed > nGreen ? nRed : nGreen;
      if (nBlue > cmax)
        cmax = nBlue;
      int cmin = nRed < nGreen ? nRed : nGreen;
      if (nBlue < cmin)
        cmin = nBlue;
  
      final float brightness = cmax / 255.0f;
      float saturation;
      if (cmax != 0)
        saturation = ((float) (cmax - cmin)) / ((float) cmax);
      else
        saturation = 0;
      float hue;
      if (saturation == 0)
        hue = 0;
      else
      {
        final float redc = ((float) (cmax - nRed)) / ((float) (cmax - cmin));
        final float greenc = ((float) (cmax - nGreen)) / ((float) (cmax - cmin));
        final float bluec = ((float) (cmax - nBlue)) / ((float) (cmax - cmin));
        if (nRed == cmax)
          hue = bluec - greenc;
        else
          if (nGreen == cmax)
            hue = 2.0f + redc - bluec;
          else
            hue = 4.0f + greenc - redc;
        hue = hue / 6.0f;
        if (hue < 0)
          hue = hue + 1.0f;
      }
      return new float [] { hue * HSL_MAX, saturation * PERCENTAGE_MAX, brightness * PERCENTAGE_MAX };
    }
docs: Get the passed RGB values as HSL values compliant for CSS in the CSS range
  (0-359, 0-100, 0-100)
  
  @param nRed
  red value
  @param nGreen
  green value
  @param nBlue
  blue value
  @return An array of 3 floats, containing hue, saturation and lightness (in
  this order). The first value is in the range 0-359, and the
  remaining two values are in the range 0-100 (percentage).