From 6cd1171fd55fd4861e6bb6a83688730e98bc7c37 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 22 Apr 2019 14:17:33 -0400 Subject: [PATCH] theme variables --- src/App/App.csproj | 3 +++ src/App/Styles/Android.xaml | 3 ++- src/App/Styles/Dark.xaml | 11 ++++++----- src/App/Styles/Light.xaml | 13 ++++++++----- src/App/Styles/Variables.xaml | 6 ++++++ src/App/Styles/Variables.xaml.cs | 12 ++++++++++++ src/App/Utilities/ThemeManager.cs | 23 +++++++++++++---------- 7 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 src/App/Styles/Variables.xaml create mode 100644 src/App/Styles/Variables.xaml.cs diff --git a/src/App/App.csproj b/src/App/App.csproj index 7627feecd..4207c0b6b 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -57,6 +57,9 @@ True True + + Variables.xaml + Light.xaml diff --git a/src/App/Styles/Android.xaml b/src/App/Styles/Android.xaml index 76862af82..51cef2d7e 100644 --- a/src/App/Styles/Android.xaml +++ b/src/App/Styles/Android.xaml @@ -4,6 +4,7 @@ x:Class="Bit.App.Styles.Android"> diff --git a/src/App/Styles/Dark.xaml b/src/App/Styles/Dark.xaml index 2f6762b99..cb6597405 100644 --- a/src/App/Styles/Dark.xaml +++ b/src/App/Styles/Dark.xaml @@ -2,9 +2,10 @@ - + #000000 + #3c8dbc + #dd4b39 + #00a65a + #555555 + #bf7e16 diff --git a/src/App/Styles/Light.xaml b/src/App/Styles/Light.xaml index cfb9582f7..e59776fe0 100644 --- a/src/App/Styles/Light.xaml +++ b/src/App/Styles/Light.xaml @@ -2,9 +2,12 @@ - + #000000 + #3c8dbc + #dd4b39 + #00a65a + #555555 + #bf7e16 + + #3c8dbc diff --git a/src/App/Styles/Variables.xaml b/src/App/Styles/Variables.xaml new file mode 100644 index 000000000..49b463edf --- /dev/null +++ b/src/App/Styles/Variables.xaml @@ -0,0 +1,6 @@ + + + + diff --git a/src/App/Styles/Variables.xaml.cs b/src/App/Styles/Variables.xaml.cs new file mode 100644 index 000000000..214142bde --- /dev/null +++ b/src/App/Styles/Variables.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace Bit.App.Styles +{ + public partial class Variables : ResourceDictionary + { + public Variables() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/App/Utilities/ThemeManager.cs b/src/App/Utilities/ThemeManager.cs index c8f9548c7..a4f1f3240 100644 --- a/src/App/Utilities/ThemeManager.cs +++ b/src/App/Utilities/ThemeManager.cs @@ -30,6 +30,19 @@ namespace Bit.App.Utilities Application.Current.Resources.Clear(); Application.Current.Resources.MergedDictionaries.Clear(); + // Variables + Application.Current.Resources.MergedDictionaries.Add(new Variables()); + + // Themed variables + if(name == "dark") + { + Application.Current.Resources.MergedDictionaries.Add(new Dark()); + } + else + { + Application.Current.Resources.MergedDictionaries.Add(new Light()); + } + // Base styles Application.Current.Resources.MergedDictionaries.Add(new Base()); @@ -42,16 +55,6 @@ namespace Bit.App.Utilities { Application.Current.Resources.MergedDictionaries.Add(new iOS()); } - - // Theme styles - if(name == "dark") - { - Application.Current.Resources.MergedDictionaries.Add(new Dark()); - } - else - { - Application.Current.Resources.MergedDictionaries.Add(new Light()); - } } } }