Here you can find the source of toRGB(float h, float s, float l)
private static byte[] toRGB(float h, float s, float l)
//package com.java2s; //License from project: Open Source License public class Main { private static byte[] toRGB(float h, float s, float l) { h = h % 360.0f;/*from w w w .j a v a 2 s . com*/ 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; float r = Math.max(0, HueToRGB(p, q, h + (1.0f / 3.0f))); float g = Math.max(0, HueToRGB(p, q, h)); float b = Math.max(0, HueToRGB(p, q, h - (1.0f / 3.0f))); r = Math.min(r, 1.0f); g = Math.min(g, 1.0f); b = Math.min(b, 1.0f); byte r_byte = (byte) Math.round(r * 255); byte g_byte = (byte) Math.round(g * 255); byte b_byte = (byte) Math.round(b * 255); return new byte[] { r_byte, g_byte, b_byte }; } private static float HueToRGB(float p, float q, float h) { if (h < 0) h += 1; if (h > 1) h -= 1; if (6 * h < 1) { return p + ((q - p) * 6 * h); } if (2 * h < 1) { return q; } if (3 * h < 2) { return p + ((q - p) * 6 * ((2.0f / 3.0f) - h)); } return p; } }