2021-08-11 14:09:03 +08:00

53 lines
2.2 KiB
C#

using Gallery.Resources.UI;
using Xamarin.Forms;
namespace Gallery.Resources.Theme
{
public abstract class Theme : ResourceDictionary
{
public const string StatusBarStyle = nameof(StatusBarStyle);
public const string WindowColor = nameof(WindowColor);
public const string TintColor = nameof(TintColor);
public const string TextColor = nameof(TextColor);
public const string SubTextColor = nameof(SubTextColor);
public const string CardBackgroundColor = nameof(CardBackgroundColor);
public const string NavigationColor = nameof(NavigationColor);
public const string NavigationSelectedColor = nameof(NavigationSelectedColor);
public const string OptionBackColor = nameof(OptionBackColor);
public const string OptionTintColor = nameof(OptionTintColor);
public const string IconLightFamily = nameof(IconLightFamily);
public const string IconRegularFamily = nameof(IconRegularFamily);
public const string IconSolidFamily = nameof(IconSolidFamily);
public const string ScreenBottomPadding = nameof(ScreenBottomPadding);
public const string IconClose = nameof(IconClose);
public const string FontIconOption = nameof(FontIconOption);
public const string FontIconRefresh = nameof(FontIconRefresh);
protected void InitResources()
{
Add(IconLightFamily, Definition.IconLightFamily);
Add(IconRegularFamily, Definition.IconRegularFamily);
Add(IconSolidFamily, Definition.IconSolidFamily);
Add(ScreenBottomPadding, Definition.ScreenBottomPadding);
Add(FontIconOption, GetFontIcon(Definition.IconOption, Definition.IconSolidFamily));
Add(FontIconRefresh, GetFontIcon(Definition.IconRefresh, Definition.IconSolidFamily));
Add(IconClose, Definition.IconClose);
}
private FontImageSource GetFontIcon(string icon, string family, Color color = default)
{
return new FontImageSource
{
FontFamily = family,
Glyph = icon,
Size = Definition.FontSizeTitle,
Color = color
};
}
}
}