示例#1
0
        /// <summary>
        /// Coerce the selected color to fulfill certain requirements: (i) the color must still be a member of the ParentColorSet of this color, and (ii) if the <see cref="ShowPlotColorsOnly"/>
        /// property is set to <c>true</c>, the color must be a member of a plot color set.
        /// </summary>
        /// <param name="color">The color that fulfills the above stated requirements.</param>
        /// <returns></returns>
        protected virtual NamedColor InternalSelectedColorCoerce(NamedColor color)
        {
            color = color.CoerceParentColorSetToNullIfNotMember();

            if (ShowPlotColorsOnly && (color.ParentColorSet == null || false == ColorSetManager.Instance.IsPlotColorSet(color.ParentColorSet)))
            {
                return(ColorSetManager.Instance.BuiltinDarkPlotColors[0]);
            }
            return(color);
        }