Skip to content

Color: Add interpolation support#3443

Merged
swharden merged 7 commits intoScottPlot:mainfrom
KroMignon:colorInterpolation
Mar 14, 2024
Merged

Color: Add interpolation support#3443
swharden merged 7 commits intoScottPlot:mainfrom
KroMignon:colorInterpolation

Conversation

@KroMignon
Copy link
Contributor

@KroMignon KroMignon commented Mar 6, 2024

Add methods to ScottPlot.Color to get interpolated colors between 2 given colors.

This should fix #3441.

Here a simple usage example.

ScottPlot.Plot myPlot = new();

var colors = ScottPlot.Color.InterpolateArrayRgb(Colors.DarkCyan, Colors.Maroon, 12);
double steps = 10;
foreach (var color in colors)
{
    var c1 = myPlot.Add.Circle(steps, steps, 25);
    steps += 25;
    c1.LineColor = color;
    c1.FillStyle.Color = color;
}
myPlot.SavePng("ColorInterpolation.png", 240, 240);

ColorInterpolation

@swharden swharden changed the title SP5: Add color interpolation support Color: Add interpolation support Mar 13, 2024
@swharden swharden merged commit 37d787c into ScottPlot:main Mar 14, 2024
@KroMignon KroMignon deleted the colorInterpolation branch March 27, 2024 07:36
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

Successfully merging this pull request may close these issues.

Color: Need a simple method to get a range of colors between two colors

2 participants