/// <summary>
        /// Default three color scale with red color as minimum, yellow as midpoint and green as maximum.
        /// </summary>
        /// <param name="centerPercentage"></param>
        /// <returns></returns>
        public CFRule AddDefaultThreeColorScale(int centerPercentage = 50)
        {
            CFRule rule = new CFRule(CFType.ColorScale);

            rule.ColorScale = ColorScale.DefaultThreeColor(centerPercentage);
            AddRule(rule);
            return(rule);
        }
        /// <summary>
        /// Default two color scale with red color as minimum and green as maxmimum.
        /// </summary>
        /// <returns></returns>
        public CFRule AddDefaultTwoColorScale()
        {
            CFRule rule = new CFRule(CFType.ColorScale);

            rule.ColorScale = ColorScale.DefaultTwoColor();
            AddRule(rule);
            return(rule);
        }
        /// <summary>
        /// Add three color scale.
        /// </summary>
        /// <param name="minimum"></param>
        /// <param name="midpoint"></param>
        /// <param name="maximum"></param>
        /// <param name="centerPercentage"></param>
        /// <returns></returns>
        public CFRule AddColorScale(Color minimum, Color midpoint, Color maximum, int centerPercentage = 50)
        {
            CFRule rule = new CFRule(CFType.ColorScale);

            rule.ColorScale = ColorScale.TwoColor(minimum, maximum);
            AddRule(rule);
            return(rule);
        }
        /// <summary>
        /// Add two color scale.
        /// </summary>
        /// <param name="colorScale"></param>
        /// <returns></returns>
        public CFRule AddColorScale(Color minimum, Color maximum)
        {
            CFRule rule = new CFRule(CFType.ColorScale);

            rule.ColorScale = ColorScale.TwoColor(minimum, maximum);
            AddRule(rule);
            return(rule);
        }
        /// <summary>
        /// Add created color scale.
        /// </summary>
        /// <param name="colorScale"></param>
        /// <returns></returns>
        public CFRule AddColorScale(ColorScale colorScale)
        {
            CFRule rule = new CFRule(CFType.ColorScale);

            rule.ColorScale = colorScale;
            AddRule(rule);
            return(rule);
        }
        /// <summary>
        /// Add color scale with specified ConditionalFormattingValueObject and Color lists.
        /// </summary>
        /// <param name="cfvoList"></param>
        /// <param name="colors"></param>
        /// <returns></returns>
        public CFRule AddColorScale(List <CFVO> cfvoList, List <Color> colors)
        {
            CFRule     rule = new CFRule(CFType.ColorScale);
            ColorScale cs   = new ColorScale();

            cs.CFVOList     = cfvoList;
            cs.Colors       = colors;
            rule.ColorScale = cs;
            AddRule(rule);
            return(rule);
        }
        public static ColorScale TwoColor(Color minimum, Color maximum)
        {
            ColorScale cs      = new ColorScale();
            var        cfvoMin = new CFVO
            {
                Type = CFVOType.Min
            };
            var cfvoMax = new CFVO
            {
                Type = CFVOType.Max
            };

            cs.CFVOList.Add(cfvoMin);
            cs.CFVOList.Add(cfvoMax);
            cs.Colors.Add(minimum);
            cs.Colors.Add(maximum);
            return(cs);
        }
        public static ColorScale ThreeColor(Color minimum, Color midpoint, Color maximum, int centerPercentage = 50)
        {
            ColorScale cs = new ColorScale
            {
                CFVOList = new List <CFVO>()
                {
                    new CFVO {
                        Type = CFVOType.Min
                    },
                    new CFVO {
                        Type = CFVOType.Percent, Value = centerPercentage.ToString()
                    },
                    new CFVO {
                        Type = CFVOType.Max
                    }
                },
                Colors = new List <Color>()
                {
                    minimum, midpoint, maximum
                }
            };

            return(cs);
        }