mirror of
https://github.com/bitwarden/android.git
synced 2025-01-09 01:37:33 +03:00
26 lines
962 B
C#
26 lines
962 B
C#
|
using System.Reflection;
|
|||
|
using Xamarin.Forms;
|
|||
|
using Xamarin.Forms.StyleSheets;
|
|||
|
|
|||
|
namespace Bit.App.Utilities
|
|||
|
{
|
|||
|
public static class ThemeManager
|
|||
|
{
|
|||
|
public static void SetTheme(string name)
|
|||
|
{
|
|||
|
var themeFormat = "Bit.App.Css.{0}.css";
|
|||
|
var assembly = IntrospectionExtensions.GetTypeInfo(typeof(App)).Assembly;
|
|||
|
// Other supported theme names can be added here.
|
|||
|
if(name == "dark")
|
|||
|
{
|
|||
|
Application.Current.Resources.Add(StyleSheet.FromAssemblyResource(assembly,
|
|||
|
string.Format(themeFormat, name)));
|
|||
|
}
|
|||
|
Application.Current.Resources.Add(StyleSheet.FromAssemblyResource(assembly,
|
|||
|
string.Format(themeFormat, Device.RuntimePlatform.ToLowerInvariant())));
|
|||
|
Application.Current.Resources.Add(StyleSheet.FromAssemblyResource(assembly,
|
|||
|
string.Format(themeFormat, "styles")));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|