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"
Grid.Row="1"
Grid.Column="0"
LineBreakMode="CharacterWrap"
IsVisible="{Binding ShowPassword}" />
<controls:FaButton
StyleClass="box-row-button, box-row-button-platform"

View file

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

View file

@ -1,5 +1,4 @@
using System;
using UIKit;
using UIKit;
using Xamarin.Forms.Platform.iOS;
namespace Bit.iOS.Core.Utilities
@ -9,25 +8,17 @@ namespace Bit.iOS.Core.Utilities
public static void SetAppearance(string theme)
{
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();
if(theme == "dark")
{
tabBarItemColor = Xamarin.Forms.Color.FromHex("#C0C0C0").ToUIColor();
primaryColor = Xamarin.Forms.Color.FromHex("#52bdfb").ToUIColor();
mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
}
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();
}
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();
}
else
@ -35,9 +26,6 @@ namespace Bit.iOS.Core.Utilities
lightTheme = true;
}
UITabBar.Appearance.TintColor = tabBarItemColor;
UITabBar.Appearance.SelectedImageTintColor = primaryColor;
UIStepper.Appearance.TintColor = mutedColor;
if(!lightTheme)
{

View file

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