public static CGColor ToCGColor(this XPlatColor color) { if (color == null) { return(new CGColor(0, 0, 0, 0)); } return(new CGColor(color.Red, color.Green, color.Blue, (int)(color.Alpha * 255))); }
public static UIColor ToNative(this XPlatColor color) { if (color == null) { return(UIColor.Clear); } return(UIColor.FromRGBA(color.Red, color.Green, color.Blue, (int)(color.Alpha * 255))); }
public static void ApplyBackgroundColor(this UIButton @this, XPlatColor color) { if (@this == null || color == null) { return; } @this.BackgroundColor = color.ToNative(); }
public static void ApplyTextColor(this UIButton @this, XPlatColor color) { if (@this == null || color == null) { return; } @this.SetTitleColor(color.ToNative(), UIControlState.Normal); }
public static void ApplyTextColor(this UILabel @this, XPlatColor color) { if (@this == null || color == null) { return; } @this.TextColor = color.ToNative(); }
public static void ApplyBorderColor(this UIView @this, XPlatColor color, int size = 1, XPlatCornerRadius cornerRadius = null) { if (@this == null || color == null) { return; } if (cornerRadius == null) { cornerRadius = new XPlatCornerRadius(5); } @this.ApplyBorder(GetRectCorners(cornerRadius), cornerRadius?.Radius ?? 0, color.ToNative(), (float)size); }