initial
This commit is contained in:
65
Billing.Shared/Themes/BaseTheme.cs
Normal file
65
Billing.Shared/Themes/BaseTheme.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using Billing.UI;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Billing.Themes;
|
||||
|
||||
public abstract class BaseTheme : ResourceDictionary
|
||||
{
|
||||
public const string CascadiaFontRegular = nameof(CascadiaFontRegular);
|
||||
public const string CascadiaFontBold = nameof(CascadiaFontBold);
|
||||
public const string RobotoCondensedFontRegular = nameof(RobotoCondensedFontRegular);
|
||||
public const string RobotoCondensedFontBold = nameof(RobotoCondensedFontBold);
|
||||
public const string WindowBackgroundColor = nameof(WindowBackgroundColor);
|
||||
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 WeekendColor = nameof(WeekendColor);
|
||||
|
||||
protected abstract Color PrimaryMauiColor { get; }
|
||||
protected abstract Color SecondaryMauiColor { get; }
|
||||
|
||||
protected void InitResources()
|
||||
{
|
||||
var robotoRegularFontFamily = Definition.GetRobotoCondensedRegularFontFamily();
|
||||
Add(CascadiaFontRegular, Definition.GetCascadiaRegularFontFamily());
|
||||
Add(CascadiaFontBold, Definition.GetCascadiaBoldFontFamily());
|
||||
Add(RobotoCondensedFontRegular, Definition.GetRobotoCondensedRegularFontFamily());
|
||||
Add(RobotoCondensedFontBold, Definition.GetRobotoCondensedBoldFontFamily());
|
||||
|
||||
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 = robotoRegularFontFamily }
|
||||
}
|
||||
});
|
||||
Add(new Style(typeof(Button))
|
||||
{
|
||||
Setters =
|
||||
{
|
||||
new Setter { Property = Button.TextColorProperty, Value = SecondaryMauiColor },
|
||||
new Setter { Property = Button.FontFamilyProperty, Value = robotoRegularFontFamily },
|
||||
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 }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
40
Billing.Shared/Themes/Dark.cs
Normal file
40
Billing.Shared/Themes/Dark.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Billing.Themes;
|
||||
|
||||
public class Dark : BaseTheme
|
||||
{
|
||||
private static Dark _instance;
|
||||
|
||||
public static Dark Instance => _instance ??= new Dark();
|
||||
|
||||
protected override Color PrimaryMauiColor => Color.White;
|
||||
protected override Color SecondaryMauiColor => Color.LightGray;
|
||||
|
||||
public Dark()
|
||||
{
|
||||
InitColors();
|
||||
InitResources();
|
||||
}
|
||||
|
||||
private void InitColors()
|
||||
{
|
||||
Add(WindowBackgroundColor, Color.Black);
|
||||
Add(PromptBackgroundColor, Color.FromRgb(0x1f, 0x1f, 0x1f));
|
||||
Add(TabBarBackgroundColor, Color.Black);
|
||||
Add(TabBarUnselectedColor, Color.FromRgb(0x82, 0x82, 0x82));
|
||||
Add(OutRangeDayColor, Color.DarkGray);
|
||||
Add(TextColor, Color.FromRgb(0xcc, 0xcc, 0xcc));
|
||||
Add(WeekendColor, Color.FromRgb(211, 5, 5));
|
||||
|
||||
Add(new Style(typeof(TabBar))
|
||||
{
|
||||
Setters =
|
||||
{
|
||||
new Setter { Property = Shell.TabBarBackgroundColorProperty, Value = Color.Black },
|
||||
new Setter { Property = Shell.TabBarTitleColorProperty, Value = PrimaryMauiColor },
|
||||
new Setter { Property = Shell.TabBarUnselectedColorProperty, Value = Color.FromRgb(0x82, 0x82, 0x82) }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
40
Billing.Shared/Themes/Light.cs
Normal file
40
Billing.Shared/Themes/Light.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Billing.Themes;
|
||||
|
||||
public class Light : BaseTheme
|
||||
{
|
||||
private static Light _instance;
|
||||
|
||||
public static Light Instance => _instance ??= new Light();
|
||||
|
||||
protected override Color PrimaryMauiColor => Color.FromRgb(0x18, 0x31, 0x53);
|
||||
protected override Color SecondaryMauiColor => Color.White;
|
||||
|
||||
public Light()
|
||||
{
|
||||
InitColors();
|
||||
InitResources();
|
||||
}
|
||||
|
||||
private void InitColors()
|
||||
{
|
||||
Add(WindowBackgroundColor, Color.White);
|
||||
Add(PromptBackgroundColor, Color.FromRgb(0xe0, 0xe0, 0xe0));
|
||||
Add(TabBarBackgroundColor, Color.White);
|
||||
Add(TabBarUnselectedColor, Color.FromRgb(0x82, 0x82, 0x82));
|
||||
Add(OutRangeDayColor, Color.LightGray);
|
||||
Add(TextColor, Color.FromRgb(0x33, 0x33, 0x33));
|
||||
Add(WeekendColor, Color.FromRgb(211, 64, 85));
|
||||
|
||||
Add(new Style(typeof(TabBar))
|
||||
{
|
||||
Setters =
|
||||
{
|
||||
new Setter { Property = Shell.TabBarBackgroundColorProperty, Value = Color.White },
|
||||
new Setter { Property = Shell.TabBarTitleColorProperty, Value = PrimaryMauiColor },
|
||||
new Setter { Property = Shell.TabBarUnselectedColorProperty, Value = Color.FromRgb(0x82, 0x82, 0x82) }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user