Ejemplo n.º 1
0
        static IPropertyValue ToGradientStop(List <CssToken> value)
        {
            var color    = default(IPropertyValue);
            var position = default(IPropertyValue);
            var items    = value.ToItems();

            if (items.Count != 0)
            {
                position = LengthOrPercentConverter.Convert(items[items.Count - 1]);

                if (position != null)
                {
                    items.RemoveAt(items.Count - 1);
                }
            }

            if (items.Count != 0)
            {
                color = ColorConverter.Convert(items[items.Count - 1]);

                if (color != null)
                {
                    items.RemoveAt(items.Count - 1);
                }
            }

            return(items.Count == 0 ? new StopValue(color, position, value) : null);
        }