Files
Shrlalgo.RvKits/WPFDark/Internals/ColorHelper.cs
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

23 lines
785 B
C#

using System.Windows.Media;
namespace WPFDark.Internals
{
internal static class ColorHelper
{
internal static Color Lerp(double ratio, Color c1, Color c2)
=> Color.FromArgb(
(byte)((c2.A - c1.A) * ratio + c1.A),
(byte)((c2.R - c1.R) * ratio + c1.R),
(byte)((c2.G - c1.G) * ratio + c1.G),
(byte)((c2.B - c1.B) * ratio + c1.B));
internal static ByteColor Lerp(double ratio, ByteColor c1, ByteColor c2)
=> new ByteColor(
(byte)((c2.A - c1.A) * ratio + c1.A),
(byte)((c2.R - c1.R) * ratio + c1.R),
(byte)((c2.G - c1.G) * ratio + c1.G),
(byte)((c2.B - c1.B) * ratio + c1.B));
}
}