Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color gradient table generator (for grahpviz) #5

Open
arnaud-m opened this issue Feb 12, 2012 · 0 comments
Open

color gradient table generator (for grahpviz) #5

arnaud-m opened this issue Feb 12, 2012 · 0 comments

Comments

@arnaud-m
Copy link
Contributor

Here two code example that could help to implement such a feature.
From http://stackoverflow.com/questions/2011832/generate-color-gradient-in-c-sharp

public IEnumerable<Color> 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/.

@ghost ghost assigned kyo06 Feb 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants