using Microsoft.UI.Xaml.Media;

namespace YMhut.Box.WinUI;

internal static class UiBrushes
{
    internal static SolidColorBrush PageBackground { get; } = Brush("#F5F6F7");
    internal static SolidColorBrush CardBackground { get; } = Brush("#FFFFFFFF");
    internal static SolidColorBrush CardStroke { get; } = Brush("#1FDADFE0");
    internal static SolidColorBrush ChromeLow { get; } = Brush("#E6F2F5F4");
    internal static SolidColorBrush ChromeMediumLow { get; } = Brush("#DADFE0");

    private static SolidColorBrush Brush(string hex)
    {
        var normalized = hex.Trim().TrimStart('#');
        if (normalized.Length == 6)
        {
            normalized = "FF" + normalized;
        }

        var color = Microsoft.UI.ColorHelper.FromArgb(
            Convert.ToByte(normalized.Substring(0, 2), 16),
            Convert.ToByte(normalized.Substring(2, 2), 16),
            Convert.ToByte(normalized.Substring(4, 2), 16),
            Convert.ToByte(normalized.Substring(6, 2), 16));
        return new SolidColorBrush(color);
    }
}
