Exemplo n.º 1
0
        public static void UpdateTextColor(this WSwipeItem platformControl, ISwipeItemMenuItem view)
        {
            var textColor = view.TextColor ?? view.GetTextColor();

            if (textColor != null)
            {
                platformControl.Foreground = textColor.ToPlatform();
            }
        }
Exemplo n.º 2
0
        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);
        }