What about an hsv color function? It could be very useful to generate random colors with a certain saturation and value, or fading from one color (hue) to another.
// hue: 0-360°; sat: 0.f-1.f; val: 0.f-1.f
sf::Color hsv(int hue, float sat, float val)
{
hue %= 360;
while(hue<0) hue += 360;
if(sat<0.f) sat = 0.f;
if(sat>1.f) sat = 1.f;
if(val<0.f) val = 0.f;
if(val>1.f) val = 1.f;
int h = hue/60;
float f = float(hue)/60-h;
float p = val*(1.f-sat);
float q = val*(1.f-sat*f);
float t = val*(1.f-sat*(1-f));
switch(h)
{
default:
case 0:
case 6: return sf::Color(val*255, t*255, p*255);
case 1: return sf::Color(q*255, val*255, p*255);
case 2: return sf::Color(p*255, val*255, t*255);
case 3: return sf::Color(p*255, q*255, val*255);
case 4: return sf::Color(t*255, p*255, val*255);
case 5: return sf::Color(val*255, p*255, q*255);
}
}