using System.Drawing; namespace Volian.Svg.Library { public class SvgFillSettings { #region ctor public SvgFillSettings() { ;} public SvgFillSettings(Color myColor) => Fill = ColorTranslator.ToHtml(myColor); #endregion #region Inheritance public SvgFillSettings MyParentsSettings { get; set; } = null; #endregion #region Internal Inherited Properties protected string InheritedFill { get { if (Fill != "" && Fill != "0" && Fill.ToLower() != "empty") return Fill; // Current Value if (MyParentsSettings != null) return MyParentsSettings.InheritedFill; // Inherited return "Black"; // Default } } #endregion #region Inherited Values public Color FillColor { get { // Fill = "None" - Eliminate, otherwise the value string myFill = InheritedFill; if (myFill.ToLower() == "none") // Eliminate return Color.Transparent; return ColorTranslator.FromHtml(myFill); } set { Fill = value == Color.Transparent || value == Color.Empty ? "none" : ColorTranslator.ToHtml(value); } } #endregion #region Properties public string Fill { get; set; } = string.Empty; #endregion } }