If you want the gradient to start at white, go to your color, and then go to black, you can do it a number of ways. Here's one way:
const int numEntries = 20;
const int halfNumEntries = numEntries / 2;
RGBColor gradient[numEntries];
HSVColor hsv = RGBToHSV (rgb); // Where rgb is the RGB color you start with
// Gradient from white to your color
for (int i = 0; i < halfNumEntries; i++)
{
float newHue = hsv.hue;
float newSat = (i / halfNumEntries) * hsv.sat;
float newVal = 1.0 + (i / halfNumEntries) * (hsv.val - 1.0);
gradient [ i ] = HSVToRGB (newHue, newSat, newVal);
}
gradient [ halfNumEntries ] = rgb;
// Gradient from your color to black
for (int i = (halfNumEntries + 1); i < numEntries; i++)
{
float newHue = hsv.hue;
float newSat = hsv.sat + ((i - halfNumEntries) / (halfNumEntries - 1)) * (0.0 - hsv.sat);
float newVal = hsv.val + ((i - halfNumEntries) / (halfNumEntries - 1)) * (0.0 - hsv.val);
gradient [ i ] = HSVToRGB (newHue, newSat, newVal);
}