public static int[] HSLtoRGB(float h,float s,float l,float alpha){
  if (s < 0.0f || s > 100.0f) {
    String message="Color parameter outside of expected range - Saturation";
    throw new IllegalArgumentException(message);
  }
  if (l < 0.0f || l > 100.0f) {
    String message="Color parameter outside of expected range - Luminance";
    throw new IllegalArgumentException(message);
  }
  if (alpha < 0.0f || alpha > 1.0f) {
    String message="Color parameter outside of expected range - Alpha";
    throw new IllegalArgumentException(message);
  }
  h=h % 360.0f;
  h/=360f;
  s/=100f;
  l/=100f;
  float q=0;
  if (l < 0.5)   q=l * (1 + s);
 else   q=(l + s) - (s * l);
  float p=2 * l - q;
  int r=Math.round(Math.max(0,HueToRGB(p,q,h + (1.0f / 3.0f)) * 256));
  int g=Math.round(Math.max(0,HueToRGB(p,q,h) * 256));
  int b=Math.round(Math.max(0,HueToRGB(p,q,h - (1.0f / 3.0f)) * 256));
  int[] array={r,g,b};
  return array;
}

public static int [ ] HSLtoRGB ( float h , float s , float l , float alpha ) { if ( s < 0.0f || s > 100.0f ) { String message = "Color parameter outside of expected range - Saturation" ; throw new IllegalArgumentException ( message ) ; } if ( l < 0.0f || l > 100.0f ) { String message = "Color parameter outside of expected range - Luminance" ; throw new IllegalArgumentException ( message ) ; } if ( alpha < 0.0f || alpha > 1.0f ) { String message = "Color parameter outside of expected range - Alpha" ; throw new IllegalArgumentException ( message ) ; } h = h % 360.0f ; h /= 360f ; s /= 100f ; l /= 100f ; float q = 0 ; if ( l < 0.5 ) q = l * ( 1 + s ) ; else q = ( l + s ) - ( s * l ) ; float p = 2 * l - q ; int r = Math . round ( Math . max ( 0 , HueToRGB ( p , q , h + ( 1.0f / 3.0f ) ) * 256 ) ) ; int g = Math . round ( Math . max ( 0 , HueToRGB ( p , q , h ) * 256 ) ) ; int b = Math . round ( Math . max ( 0 , HueToRGB ( p , q , h - ( 1.0f / 3.0f ) ) * 256 ) ) ; int [ ] array = { r , g , b } ; return array ; }
convert hsl values to a rgb color .
