utilities feature
This commit is contained in:
35
Gallery.Share/Resources/Theme/DarkTheme.cs
Normal file
35
Gallery.Share/Resources/Theme/DarkTheme.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Gallery.Services;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Gallery.Resources.Theme
|
||||
{
|
||||
public class DarkTheme : Theme
|
||||
{
|
||||
private static DarkTheme instance;
|
||||
public static DarkTheme Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new DarkTheme();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public DarkTheme()
|
||||
{
|
||||
InitColors();
|
||||
InitResources();
|
||||
}
|
||||
|
||||
private void InitColors()
|
||||
{
|
||||
Add(StatusBarStyle, StatusBarStyles.WhiteText);
|
||||
Add(NavigationColor, Color.FromRgb(0x11, 0x11, 0x11));
|
||||
|
||||
Add(Primary, Color.FromRgb(33, 150, 243));
|
||||
}
|
||||
}
|
||||
}
|
35
Gallery.Share/Resources/Theme/LightTheme.cs
Normal file
35
Gallery.Share/Resources/Theme/LightTheme.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Gallery.Services;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Gallery.Resources.Theme
|
||||
{
|
||||
public class LightTheme : Theme
|
||||
{
|
||||
private static LightTheme instance;
|
||||
public static LightTheme Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new LightTheme();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public LightTheme()
|
||||
{
|
||||
InitColors();
|
||||
InitResources();
|
||||
}
|
||||
|
||||
private void InitColors()
|
||||
{
|
||||
Add(StatusBarStyle, StatusBarStyles.DarkText);
|
||||
Add(NavigationColor, Color.FromRgb(0xf0, 0xf0, 0xf0));
|
||||
|
||||
Add(Primary, Color.FromRgb(33, 150, 243));
|
||||
}
|
||||
}
|
||||
}
|
44
Gallery.Share/Resources/Theme/Theme.cs
Normal file
44
Gallery.Share/Resources/Theme/Theme.cs
Normal file
@ -0,0 +1,44 @@
|
||||
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 NavigationColor = nameof(NavigationColor);
|
||||
|
||||
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 FontIconRefresh = nameof(FontIconRefresh);
|
||||
|
||||
public const string Primary = nameof(Primary);
|
||||
|
||||
protected void InitResources()
|
||||
{
|
||||
Add(IconLightFamily, Definition.IconLightFamily);
|
||||
Add(IconRegularFamily, Definition.IconRegularFamily);
|
||||
Add(IconSolidFamily, Definition.IconSolidFamily);
|
||||
Add(ScreenBottomPadding, Definition.ScreenBottomPadding);
|
||||
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user