Here you can find the source of hsl2rgb(double h, double s, double l)
public static int[] hsl2rgb(double h, double s, double l)
//package com.java2s; //License from project: Open Source License public class Main { public static int[] hsl2rgb(double h, double s, double l) { //h *= 360.0; double r, g, b; if (s <= 0) { r = g = b = l;/*w ww . j ava2 s.c o m*/ } else { double q = l < 0.5 ? l * (1 + s) : l + s - l * s; double p = 2 * l - q; r = hue2rgb(p, q, h + 1 / 3.0); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1 / 3.0); } return new int[] { (int) Math.round(r * 255), (int) Math.round(g * 255), (int) Math.round(b * 255) }; } protected static double hue2rgb(double p, double q, double t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6.0) return p + (q - p) * 6 * t; if (t < 1 / 2.0) return q; if (t < 2 / 3.0) return p + (q - p) * (2 / 3.0 - t) * 6; return p; } }