mirror of
https://github.com/bitwarden/mobile.git
synced 2024-09-27 03:52:57 +02:00
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
using Android.Graphics;
|
|
using Bit.App.Utilities;
|
|
using Xamarin.Forms.Platform.Android;
|
|
|
|
namespace Bit.Droid.Utilities
|
|
{
|
|
public class ThemeHelpers
|
|
{
|
|
public static bool LightTheme = true;
|
|
|
|
public static Color PrimaryColor
|
|
{
|
|
get => ThemeManager.GetResourceColor("PrimaryColor").ToAndroid();
|
|
}
|
|
public static Color MutedColor
|
|
{
|
|
get => ThemeManager.GetResourceColor("MutedColor").ToAndroid();
|
|
}
|
|
public static Color BackgroundColor
|
|
{
|
|
get => ThemeManager.GetResourceColor("BackgroundColor").ToAndroid();
|
|
}
|
|
public static Color NavBarBackgroundColor
|
|
{
|
|
get => ThemeManager.GetResourceColor("NavigationBarBackgroundColor").ToAndroid();
|
|
}
|
|
public static Color FabColor
|
|
{
|
|
get => ThemeManager.GetResourceColor("FabColor").ToAndroid();
|
|
}
|
|
public static Color SwitchOnColor
|
|
{
|
|
get => ThemeManager.GetResourceColor("SwitchOnColor").ToAndroid();
|
|
}
|
|
public static Color SwitchThumbColor
|
|
{
|
|
get => ThemeManager.GetResourceColor("SwitchThumbColor").ToAndroid();
|
|
}
|
|
|
|
public static void SetAppearance(string theme, bool osDarkModeEnabled)
|
|
{
|
|
SetThemeVariables(theme, osDarkModeEnabled);
|
|
}
|
|
|
|
public static int GetDialogTheme()
|
|
{
|
|
if (LightTheme)
|
|
{
|
|
return Android.Resource.Style.ThemeMaterialLightDialog;
|
|
}
|
|
return Android.Resource.Style.ThemeMaterialDialog;
|
|
}
|
|
|
|
private static void SetThemeVariables(string theme, bool osDarkModeEnabled)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(theme) && osDarkModeEnabled)
|
|
{
|
|
theme = "dark";
|
|
}
|
|
|
|
if (theme == "dark" || theme == "black" || theme == "nord")
|
|
{
|
|
LightTheme = false;
|
|
}
|
|
else
|
|
{
|
|
LightTheme = true;
|
|
}
|
|
}
|
|
}
|
|
}
|