108 lines
4.6 KiB
C#
108 lines
4.6 KiB
C#
using Billing.UI;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Billing.Themes
|
|
{
|
|
public abstract class BaseTheme : ResourceDictionary
|
|
{
|
|
public const double DefaultFontSize = 15.0;
|
|
|
|
public static Color CurrentPrimaryColor => (Color)Application.Current.Resources[PrimaryColor];
|
|
public static Color CurrentTextColor => (Color)Application.Current.Resources[TextColor];
|
|
public static Color CurrentSecondaryTextColor => (Color)Application.Current.Resources[SecondaryTextColor];
|
|
|
|
public const string FontSemiBold = nameof(FontSemiBold);
|
|
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()
|
|
{
|
|
Add(FontSemiBold, Definition.SemiBoldFontFamily);
|
|
Add(FontBold, Definition.BoldFontFamily);
|
|
|
|
Add(PrimaryColor, PrimaryMauiColor);
|
|
Add(SecondaryColor, SecondaryMauiColor);
|
|
Add(TabBarTitleColor, PrimaryMauiColor);
|
|
|
|
Add(new Style(typeof(Label))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Label.FontSizeProperty, Value = DefaultFontSize },
|
|
new Setter { Property = Label.TextColorProperty, Value = PrimaryMauiColor },
|
|
new Setter { Property = Label.FontFamilyProperty, Value = Definition.RegularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionEntry))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Entry.FontSizeProperty, Value = DefaultFontSize },
|
|
new Setter { Property = Entry.FontFamilyProperty, Value = Definition.RegularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionEditor))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Editor.FontSizeProperty, Value = DefaultFontSize },
|
|
new Setter { Property = Editor.FontFamilyProperty, Value = Definition.RegularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionDatePicker))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = DatePicker.FontSizeProperty, Value = DefaultFontSize },
|
|
new Setter { Property = DatePicker.FontFamilyProperty, Value = Definition.RegularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionTimePicker))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = TimePicker.FontSizeProperty, Value = DefaultFontSize },
|
|
new Setter { Property = TimePicker.FontFamilyProperty, Value = Definition.RegularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(OptionPicker))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Picker.FontSizeProperty, Value = DefaultFontSize },
|
|
new Setter { Property = Picker.FontFamilyProperty, Value = Definition.RegularFontFamily }
|
|
}
|
|
});
|
|
Add(new Style(typeof(TintImage))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = TintHelper.TintColorProperty, Value = PrimaryMauiColor }
|
|
}
|
|
});
|
|
Add(new Style(typeof(TintImageButton))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = TintHelper.TintColorProperty, Value = PrimaryMauiColor }
|
|
}
|
|
});
|
|
}
|
|
}
|
|
} |