public static void UpdateTextColor(this WSwipeItem platformControl, ISwipeItemMenuItem view) { var textColor = view.TextColor ?? view.GetTextColor(); if (textColor != null) { platformControl.Foreground = textColor.ToPlatform(); } }
public static Color?GetTextColor(this ISwipeItemMenuItem swipeItemMenuItem) { Color?backgroundColor = swipeItemMenuItem.Background?.ToColor(); if (backgroundColor == null) { return(null); } var luminosity = 0.2126f * backgroundColor.Red + 0.7152f * backgroundColor.Green + 0.0722f * backgroundColor.Blue; return(luminosity < 0.75f ? Colors.White : Colors.Black); }