98 lines
4.4 KiB
C#
98 lines
4.4 KiB
C#
using Billing.UI;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Billing.Themes
|
|
{
|
|
public abstract class BaseTheme : ResourceDictionary
|
|
{
|
|
public static Color CurrentPrimaryColor => (Color)Application.Current.Resources[PrimaryColor];
|
|
|
|
public const string FontBold = nameof(FontBold);
|
|
|
|
public const string WindowBackgroundColor = nameof(WindowBackgroundColor);
|
|
public const string OptionTintColor = nameof(OptionTintColor);
|
|
public const string PromptBackgroundColor = nameof(PromptBackgroundColor);
|
|
public const string PrimaryColor = nameof(PrimaryColor);
|
|
public const string SecondaryColor = nameof(SecondaryColor);
|
|
public const string TabBarBackgroundColor = nameof(TabBarBackgroundColor);
|
|
public const string TabBarTitleColor = nameof(TabBarTitleColor);
|
|
public const string TabBarUnselectedColor = nameof(TabBarUnselectedColor);
|
|
public const string OutRangeDayColor = nameof(OutRangeDayColor);
|
|
public const string TextColor = nameof(TextColor);
|
|
public const string SecondaryTextColor = nameof(SecondaryTextColor);
|
|
public const string RedColor = nameof(RedColor);
|
|
public const string GreenColor = nameof(GreenColor);
|
|
|
|
protected abstract Color PrimaryMauiColor { get; }
|
|
protected abstract Color SecondaryMauiColor { get; }
|
|
|
|
protected void InitResources()
|
|
{
|
|
var regularFontFamily = Definition.GetRegularFontFamily();
|
|
Add(FontBold, Definition.GetBoldFontFamily());
|
|
|
|
Add(PrimaryColor, PrimaryMauiColor);
|
|
Add(SecondaryColor, SecondaryMauiColor);
|
|
Add(TabBarTitleColor, PrimaryMauiColor);
|
|
|
|
Add(new Style(typeof(Label))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Label.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Label)) },
|
|
new Setter { Property = Label.TextColorProperty, Value = PrimaryMauiColor },
|
|
new Setter { Property = Label.FontFamilyProperty, Value = regularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionEntry))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Entry.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Entry)) },
|
|
new Setter { Property = Entry.FontFamilyProperty, Value = regularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionEditor))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Editor.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Editor)) },
|
|
new Setter { Property = Editor.FontFamilyProperty, Value = regularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionDatePicker))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = DatePicker.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(DatePicker)) },
|
|
new Setter { Property = DatePicker.FontFamilyProperty, Value = regularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionTimePicker))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = TimePicker.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(TimePicker)) },
|
|
new Setter { Property = TimePicker.FontFamilyProperty, Value = regularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(Button))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Button.TextColorProperty, Value = SecondaryMauiColor },
|
|
new Setter { Property = Button.FontFamilyProperty, Value = regularFontFamily },
|
|
new Setter { Property = VisualElement.BackgroundColorProperty, Value = PrimaryMauiColor },
|
|
new Setter { Property = Button.PaddingProperty, Value = new Thickness(14, 10) }
|
|
}
|
|
});
|
|
Add(new Style(typeof(TintImage))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = TintImage.PrimaryColorProperty, Value = PrimaryMauiColor }
|
|
}
|
|
});
|
|
}
|
|
}
|
|
} |