-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
If this doesn't already exist, it should be added to the list of colormaps and documented with a cookbook recipe.
Idea came from #2191
public class PaletteColormap : ScottPlot.Drawing.IColormap
{
public string Name => "SpecialColormap";
private readonly byte[] RedValues = new byte[256];
private readonly byte[] GreenValues = new byte[256];
private readonly byte[] BlueValues = new byte[256];
public PaletteColormap(Color[] colors)
{
for (int i = 0; i < RedValues.Length; i++)
{
int colorIndex = colors.Length * i / RedValues.Length;
RedValues[i] = colors[colorIndex].R;
GreenValues[i] = colors[colorIndex].G;
BlueValues[i] = colors[colorIndex].B;
}
}
public (byte r, byte g, byte b) GetRGB(byte value)
{
return (RedValues[value], GreenValues[value], BlueValues[value]);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
