Browse Source

Fix platform settings returning empty color

pull/10923/head
Max Katz 4 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) if (tintColor is not null)
{ {
tintColor.GetRGBA(out var red, out var green, out var blue, out var alpha); 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, return _lastColorValues = new PlatformColorValues
ContrastPreference = contrastPreference, {
AccentColor1 = new Color( ThemeVariant = themeVariant,
(byte)(alpha * 255), ContrastPreference = contrastPreference,
(byte)(red * 255), AccentColor1 = new Color(
(byte)(green * 255), (byte)(alpha * 255),
(byte)(blue * 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() public void TraitCollectionDidChange()

Loading…
Cancel
Save