示例#1
0
        public List <IGradient> Parse(string css)
        {
            var builder = new GradientBuilder();

            if (string.IsNullOrWhiteSpace(css))
            {
                return(builder.Build());
            }

            var reader = new CssReader(css);

            while (reader.CanRead)
            {
                var token = reader.Read().Trim();

                var definition = _definitions.FirstOrDefault(x => x.IsMatch(token));
                definition?.Parse(reader, builder);

                reader.MoveNext();
            }

            return(builder.BuildReversed());
        }