Install Mixbox from the NuGet package: https://www.nuget.org/packages/Mixbox/2.0.0
using System.Drawing;
using Scrtwpns.Mixbox;
public class HelloMixbox
{
public static void Main(string[] args)
{
Color color1 = Color.FromArgb(0, 33, 133); // blue
Color color2 = Color.FromArgb(252, 211, 0); // yellow
float t = 0.5f; // mixing ratio
Color colorMix = Color.FromArgb(Mixbox.Lerp(color1.ToArgb(), color2.ToArgb(), t));
System.Console.WriteLine(colorMix);
}
}
Color MixThree(Color color1, Color color2, Color color3)
{
MixboxLatent z1 = Mixbox.RGBToLatent(color1.ToArgb());
MixboxLatent z2 = Mixbox.RGBToLatent(color2.ToArgb());
MixboxLatent z3 = Mixbox.RGBToLatent(color3.ToArgb());
// mix 30% of color1, 60% of color2, and 10% of color3
MixboxLatent zMix = 0.3f*z1 + 0.6f*z2 + 0.1f*z3;
return Color.FromArgb(Mixbox.LatentToRGB(zMix));
}
Copyright (c) 2022, Secret Weapons. All rights reserved.
Mixbox is provided under the CC BY-NC 4.0 license for non-commercial use only.
If you want to obtain commercial license, please contact: [email protected]