Skip to content

Colormap: interpolate from collection of colors #4247

@swharden

Description

@swharden

There should be a way to create a colormap starting from a collection of colors. I don't recall whether this is already possible.

Related, Color.InterpolateRgbArray:

static public Color[] InterpolateRgbArray(Color c1, Color c2, int steps)
{
var stepFactor = 1.0 / (steps - 1);
var array = new Color[steps];
for (var i = 0; i < steps; ++i)
{
array[i] = InterpolateRgb(c1, c2, stepFactor * i);
}
return array;
}

Note that similar functionality exists in Python

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions