Browse Source

Fix platform settings returning empty color

pull/10923/head
Max Katz 3 years ago
parent
commit
3a6b44a5cf
  1. 31
      src/iOS/Avalonia.iOS/PlatformSettings.cs

31
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()

Loading…
Cancel
Save