24 lines
1.4 KiB
C#
24 lines
1.4 KiB
C#
|
|
using BuyMeCofee.Maui.Constants;
|
||
|
|
using BuyMeCofee.Maui.Enums;
|
||
|
|
using BuyMeCofee.Maui.Models;
|
||
|
|
|
||
|
|
namespace BuyMeCofee.Maui.Helpers;
|
||
|
|
|
||
|
|
public static class BmcThemeResolver
|
||
|
|
{
|
||
|
|
public static BmcThemeInfo Resolve(BmcButtonTheme theme) => theme switch
|
||
|
|
{
|
||
|
|
BmcButtonTheme.Yellow => new(Color.FromArgb(BmcColors.YellowBg), Color.FromArgb(BmcColors.BrandDark), Colors.Transparent),
|
||
|
|
BmcButtonTheme.Black => new(Color.FromArgb(BmcColors.BlackBg), Colors.White, Colors.Transparent),
|
||
|
|
BmcButtonTheme.White => new(Color.FromArgb(BmcColors.WhiteBg), Color.FromArgb(BmcColors.BrandDark), Color.FromArgb(BmcColors.WhiteStroke)),
|
||
|
|
BmcButtonTheme.Blue => new(Color.FromArgb(BmcColors.BlueBg), Colors.White, Colors.Transparent),
|
||
|
|
BmcButtonTheme.Violet => new(Color.FromArgb(BmcColors.VioletBg), Colors.White, Colors.Transparent),
|
||
|
|
BmcButtonTheme.Orange => new(Color.FromArgb(BmcColors.OrangeBg), Colors.White, Colors.Transparent),
|
||
|
|
BmcButtonTheme.Red => new(Color.FromArgb(BmcColors.RedBg), Colors.White, Colors.Transparent),
|
||
|
|
BmcButtonTheme.Green => new(Color.FromArgb(BmcColors.GreenBg), Colors.White, Colors.Transparent),
|
||
|
|
BmcButtonTheme.Custom => throw new InvalidOperationException(
|
||
|
|
"Custom theme requires setting CustomBackgroundColor and CustomTextColor properties directly."),
|
||
|
|
_ => throw new ArgumentOutOfRangeException(nameof(theme))
|
||
|
|
};
|
||
|
|
}
|