ios theming

This commit is contained in:
Kyle Spearrin 2019-06-24 15:13:33 -04:00
parent d9c947ccd0
commit 45fbdb8411
4 changed files with 11 additions and 17 deletions

View file

@ -120,6 +120,7 @@
StyleClass="box-value" StyleClass="box-value"
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
LineBreakMode="CharacterWrap"
IsVisible="{Binding ShowPassword}" /> IsVisible="{Binding ShowPassword}" />
<controls:FaButton <controls:FaButton
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"

View file

@ -39,11 +39,11 @@
<Setter Property="BackgroundColor" <Setter Property="BackgroundColor"
Value="{StaticResource ListHeaderBackgroundColor}" /> Value="{StaticResource ListHeaderBackgroundColor}" />
<Setter Property="TextColor" <Setter Property="TextColor"
Value="{StaticResource TextColor}" /> Value="Black" />
<Setter Property="CancelButtonColor" <Setter Property="CancelButtonColor"
Value="{StaticResource PrimaryColor}" /> Value="{StaticResource PrimaryColor}" />
<Setter Property="PlaceholderColor" <Setter Property="PlaceholderColor"
Value="{StaticResource MutedColor}" /> Value="#777777" />
</Style> </Style>
<Style TargetType="ContentPage" <Style TargetType="ContentPage"
ApplyToDerivedTypes="True"> ApplyToDerivedTypes="True">

View file

@ -1,5 +1,4 @@
using System; using UIKit;
using UIKit;
using Xamarin.Forms.Platform.iOS; using Xamarin.Forms.Platform.iOS;
namespace Bit.iOS.Core.Utilities namespace Bit.iOS.Core.Utilities
@ -9,25 +8,17 @@ namespace Bit.iOS.Core.Utilities
public static void SetAppearance(string theme) public static void SetAppearance(string theme)
{ {
var lightTheme = false; var lightTheme = false;
var tabBarItemColor = Xamarin.Forms.Color.FromHex("#757575").ToUIColor();
var primaryColor = Xamarin.Forms.Color.FromHex("#3c8dbc").ToUIColor();
var mutedColor = Xamarin.Forms.Color.FromHex("#777777").ToUIColor(); var mutedColor = Xamarin.Forms.Color.FromHex("#777777").ToUIColor();
if(theme == "dark") if(theme == "dark")
{ {
tabBarItemColor = Xamarin.Forms.Color.FromHex("#C0C0C0").ToUIColor();
primaryColor = Xamarin.Forms.Color.FromHex("#52bdfb").ToUIColor();
mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor(); mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
} }
else if(theme == "black") else if(theme == "black")
{ {
tabBarItemColor = Xamarin.Forms.Color.FromHex("#C0C0C0").ToUIColor();
primaryColor = Xamarin.Forms.Color.FromHex("#52bdfb").ToUIColor();
mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor(); mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
} }
else if(theme == "nord") else if(theme == "nord")
{ {
tabBarItemColor = Xamarin.Forms.Color.FromHex("#e5e9f0").ToUIColor();
primaryColor = Xamarin.Forms.Color.FromHex("#81a1c1").ToUIColor();
mutedColor = Xamarin.Forms.Color.FromHex("#d8dee9").ToUIColor(); mutedColor = Xamarin.Forms.Color.FromHex("#d8dee9").ToUIColor();
} }
else else
@ -35,9 +26,6 @@ namespace Bit.iOS.Core.Utilities
lightTheme = true; lightTheme = true;
} }
UITabBar.Appearance.TintColor = tabBarItemColor;
UITabBar.Appearance.SelectedImageTintColor = primaryColor;
UIStepper.Appearance.TintColor = mutedColor; UIStepper.Appearance.TintColor = mutedColor;
if(!lightTheme) if(!lightTheme)
{ {
@ -45,4 +33,4 @@ namespace Bit.iOS.Core.Utilities
} }
} }
} }
} }

View file

@ -7,10 +7,15 @@ namespace Bit.iOS.Renderers
{ {
public class CustomTabbedRenderer : TabbedRenderer public class CustomTabbedRenderer : TabbedRenderer
{ {
public CustomTabbedRenderer() protected override void OnElementChanged(VisualElementChangedEventArgs e)
{ {
base.OnElementChanged(e);
TabBar.Translucent = false; TabBar.Translucent = false;
TabBar.Opaque = true; TabBar.Opaque = true;
TabBar.SelectedImageTintColor =
((Color)Xamarin.Forms.Application.Current.Resources["TabBarSelectedItemColor"]).ToUIColor();
TabBar.UnselectedItemTintColor =
((Color)Xamarin.Forms.Application.Current.Resources["TabBarItemColor"]).ToUIColor();
} }
} }
} }