theme variables

This commit is contained in:
Kyle Spearrin 2019-04-22 14:17:33 -04:00
parent c3fe3292ad
commit 6cd1171fd5
7 changed files with 50 additions and 21 deletions

View file

@ -57,6 +57,9 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
</Compile> </Compile>
<Compile Update="Styles\Variables.xaml.cs">
<DependentUpon>Variables.xaml</DependentUpon>
</Compile>
<Compile Update="Styles\Light.xaml.cs"> <Compile Update="Styles\Light.xaml.cs">
<DependentUpon>Light.xaml</DependentUpon> <DependentUpon>Light.xaml</DependentUpon>
</Compile> </Compile>

View file

@ -4,6 +4,7 @@
x:Class="Bit.App.Styles.Android"> x:Class="Bit.App.Styles.Android">
<Style TargetType="Label" <Style TargetType="Label"
Class="list-header-platform"> Class="list-header-platform">
<Setter Property="TextColor"
Value="{StaticResource ListHeaderTextColor}" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>

View file

@ -2,9 +2,10 @@
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms" <ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Styles.Dark"> x:Class="Bit.App.Styles.Dark">
<Style TargetType="Label" <Color x:Key="TextColor">#000000</Color>
Class="list-header-themed"> <Color x:Key="PrimaryColor">#3c8dbc</Color>
<Setter Property="TextColor" <Color x:Key="DangerColor">#dd4b39</Color>
Value="Green" /> <Color x:Key="SuccessColor">#00a65a</Color>
</Style> <Color x:Key="InfoColor">#555555</Color>
<Color x:Key="WarningColor">#bf7e16</Color>
</ResourceDictionary> </ResourceDictionary>

View file

@ -2,9 +2,12 @@
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms" <ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Styles.Light"> x:Class="Bit.App.Styles.Light">
<Style TargetType="Label" <Color x:Key="TextColor">#000000</Color>
Class="list-header-themed"> <Color x:Key="PrimaryColor">#3c8dbc</Color>
<Setter Property="TextColor" <Color x:Key="DangerColor">#dd4b39</Color>
Value="Blue" /> <Color x:Key="SuccessColor">#00a65a</Color>
</Style> <Color x:Key="InfoColor">#555555</Color>
<Color x:Key="WarningColor">#bf7e16</Color>
<Color x:Key="ListHeaderTextColor">#3c8dbc</Color>
</ResourceDictionary> </ResourceDictionary>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Styles.Variables">
</ResourceDictionary>

View file

@ -0,0 +1,12 @@
using Xamarin.Forms;
namespace Bit.App.Styles
{
public partial class Variables : ResourceDictionary
{
public Variables()
{
InitializeComponent();
}
}
}

View file

@ -30,6 +30,19 @@ namespace Bit.App.Utilities
Application.Current.Resources.Clear(); Application.Current.Resources.Clear();
Application.Current.Resources.MergedDictionaries.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 // Base styles
Application.Current.Resources.MergedDictionaries.Add(new Base()); Application.Current.Resources.MergedDictionaries.Add(new Base());
@ -42,16 +55,6 @@ namespace Bit.App.Utilities
{ {
Application.Current.Resources.MergedDictionaries.Add(new iOS()); 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());
}
} }
} }
} }