File: SKColorExtensions.cs
Web Access
Project: src\src\Graphics\src\Graphics.Skia\Graphics.Skia.csproj (Microsoft.Maui.Graphics.Skia)
using SkiaSharp;
 
namespace Microsoft.Maui.Graphics.Skia
{
	public static class SKColorExtensions
	{
		public static SKColor ToColor(this Color target, float alpha = 1)
		{
			var r = (byte)(target.Red * 255f);
			var g = (byte)(target.Green * 255f);
			var b = (byte)(target.Blue * 255f);
			var a = (byte)(target.Alpha * 255f * alpha);
 
			return new SKColor(r, g, b, a);
		}
	}
}