arnaud-m/opossum — Issue #5: color gradient table generator (for grahpviz)
Author: arnaud-m
Created: 2012-02-12 12:53:24+00:00
State: open

From http://stackoverflow.com/questions/2011832/generate-color-gradient-in-c-sharp

public IEnumerable GetGradients(Color start, Color end, int steps)
{
Color stepper = Color.FromArgb((byte)((end.A - start.A) / (steps - 1)),
(byte)((end.R - start.R) / (steps - 1)),
(byte)((end.G - start.G) / (steps - 1)),
(byte)((end.B - start.B) / (steps - 1)));
for (int i = 0; i < steps; i++)
{
yield return Color.FromArgb(start.A + (stepper.A * i),
start.R + (stepper.R * i),
start.G + (stepper.G * i),
start.B + (stepper.B * i));
}
}

in php, http://www.herethere.net/~samson/php/color_gradient/.