I'm trying to find a way to convert from HSL to RGB but I seem to have problems finding the actual algorithm for it.
I found a segment of C++ code but even stranger is that it goes from 0-360 (like I thought it was supposed to do) even though in some editors it seems to cut off at 240.
Here is what I got from http://astronomy.swin.edu.au/~pbourke/colour/hsl/
COLOUR c2,sat,ctmp;
while (c1.h < 0)
c1.h += 360;
while (c1.h > 360)
c1.h -= 360;
if (c1.h < 120) {
sat.r = (120 - c1.h) / 60.0;
sat.g = c1.h / 60.0;
sat.b = 0;
} else if (c1.h < 240) {
sat.r = 0;
sat.g = (240 - c1.h) / 60.0;
sat.b = (c1.h - 120) / 60.0;
} else {
sat.r = (c1.h - 240) / 60.0;
sat.g = 0;
sat.b = (360 - c1.h) / 60.0;
}
sat.r = MIN(sat.r,1);
sat.g = MIN(sat.g,1);
sat.b = MIN(sat.b,1);
ctmp.r = 2 * c1.s * sat.r + (1 - c1.s);
ctmp.g = 2 * c1.s * sat.g + (1 - c1.s);
ctmp.b = 2 * c1.s * sat.b + (1 - c1.s);
if (c1.l < 0.5) {
c2.r = c1.l * ctmp.r;
c2.g = c1.l * ctmp.g;
c2.b = c1.l * ctmp.b;
} else {
c2.r = (1 - c1.l) * ctmp.r + 2 * c1.l - 1;
c2.g = (1 - c1.l) * ctmp.g + 2 * c1.l - 1;
c2.b = (1 - c1.l) * ctmp.b + 2 * c1.l - 1;
}
return(c2);
}
I want to convert it but I think threre is a better eay (since I only really need it for ONE conversion
h = 27, s = 240 or something more appropriate for skin tones)</0>
Anyway; RGB 247,216,167 is a decent light skin tone. Play around with those values until you find what you're looking for.