-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
Add a tool to make it easier to mix two colors.
Color Mix(Color colorA, Color colorB, double fracA)
{
byte r = (byte)((colorA.R * (1 - fracA)) + colorB.R * fracA);
byte g = (byte)((colorA.G * (1 - fracA)) + colorB.G * fracA);
byte b = (byte)((colorA.B * (1 - fracA)) + colorB.B * fracA);
return Color.FromArgb(r, g, b);
}Color Mix(string hexA, string hexB, double fracA)
{
Color colorA = ColorTranslator.FromHtml(hexA);
Color colorB = ColorTranslator.FromHtml(hexB);
return Mix(colorA, colorB, fracA);
}Example Usage
for (int i = abf.sweepCount - 1; i >= 0; i--)
{
double frac = (double)i / (abf.sweepCount - 1);
Color color = Mix("#8181f2", "#a2f0ca", frac);
var trace = abf.GetSweep(i);
plt.PlotSignal(
ys: trace.values,
sampleRate: trace.sampleRate,
color: color,
yOffset: i * 15,
xOffset: i * .025,
maxRenderIndex: 20000, lineWidth: 2);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
