67 lines
2.1 KiB
C#
67 lines
2.1 KiB
C#
using Billing.UI;
|
|
using Xamarin.Essentials;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Billing.Themes
|
|
{
|
|
public class Light : BaseTheme
|
|
{
|
|
private static Light _instance;
|
|
|
|
public static Light Instance => _instance ??= new Light();
|
|
|
|
private Color primaryColor;
|
|
|
|
protected override Color PrimaryMauiColor => primaryColor;
|
|
protected override Color SecondaryMauiColor => Color.White;
|
|
|
|
public Light()
|
|
{
|
|
var color = Preferences.Get(Definition.PrimaryColorKey, "#183153");
|
|
primaryColor = Color.FromHex(color);
|
|
|
|
InitColors();
|
|
InitResources();
|
|
}
|
|
|
|
public void RefreshColor(Color primary)
|
|
{
|
|
primaryColor = primary;
|
|
Clear();
|
|
|
|
InitColors();
|
|
InitResources();
|
|
}
|
|
|
|
private void InitColors()
|
|
{
|
|
Add(WindowBackgroundColor, Color.White);
|
|
Add(OptionTintColor, 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(SecondaryTextColor, Color.DimGray);
|
|
Add(RedColor, Color.FromRgb(211, 64, 85));
|
|
Add(GreenColor, Color.FromRgb(64, 211, 85));
|
|
|
|
Add(new Style(typeof(TabBar))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = Shell.TabBarBackgroundColorProperty, Value = Color.White },
|
|
new Setter { Property = Shell.TabBarTitleColorProperty, Value = primaryColor },
|
|
new Setter { Property = Shell.TabBarUnselectedColorProperty, Value = Color.FromRgb(0x82, 0x82, 0x82) }
|
|
}
|
|
});
|
|
Add(new Style(typeof(TableView))
|
|
{
|
|
Setters =
|
|
{
|
|
new Setter { Property = VisualElement.BackgroundColorProperty, Value = Color.FromRgb(242, 241, 245) }
|
|
}
|
|
});
|
|
}
|
|
}
|
|
} |