From 3a6b44a5cf3a89d364080362fc7abfdd87dfb10f Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 5 Apr 2023 16:13:58 -0400 Subject: [PATCH] Fix platform settings returning empty color --- src/iOS/Avalonia.iOS/PlatformSettings.cs | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/iOS/Avalonia.iOS/PlatformSettings.cs b/src/iOS/Avalonia.iOS/PlatformSettings.cs index 082966f5b2..07e366e79e 100644 --- a/src/iOS/Avalonia.iOS/PlatformSettings.cs +++ b/src/iOS/Avalonia.iOS/PlatformSettings.cs @@ -31,24 +31,25 @@ internal class PlatformSettings : DefaultPlatformSettings if (tintColor is not null) { tintColor.GetRGBA(out var red, out var green, out var blue, out var alpha); - return _lastColorValues = new PlatformColorValues + if (red != 0 && green != 0 && blue != 0 && alpha != 0) { - ThemeVariant = themeVariant, - ContrastPreference = contrastPreference, - AccentColor1 = new Color( - (byte)(alpha * 255), - (byte)(red * 255), - (byte)(green * 255), - (byte)(blue * 255)) - }; + return _lastColorValues = new PlatformColorValues + { + ThemeVariant = themeVariant, + ContrastPreference = contrastPreference, + AccentColor1 = new Color( + (byte)(alpha * 255), + (byte)(red * 255), + (byte)(green * 255), + (byte)(blue * 255)) + }; + } } - else + + return _lastColorValues = new PlatformColorValues { - return _lastColorValues = new PlatformColorValues - { - ThemeVariant = themeVariant, ContrastPreference = contrastPreference - }; - } + ThemeVariant = themeVariant, ContrastPreference = contrastPreference + }; } public void TraitCollectionDidChange()