21 [NanoXlsxPlugIn(PlugInUUID = PlugInUUID.ColorWriter)]
30 public IEnumerable<XmlAttribute> GetAttributes(Color color)
32 List<XmlAttribute> attributes =
new List<XmlAttribute>();
33 string name = GetAttributeName(color);
36 string value = GetAttributeValue(color);
37 attributes.Add(
new XmlAttribute(name, value));
39 if (UseTintAttribute(color))
41 attributes.Add(
new XmlAttribute(
"tint", GetTintAttributeValue(color)));
52 public string GetAttributeName(Color color)
56 case Color.ColorType.Auto:
58 case Color.ColorType.Rgb:
60 case Color.ColorType.Indexed:
62 case Color.ColorType.Theme:
64 case Color.ColorType.System:
77 public string GetAttributeValue(Color color)
82 case Color.ColorType.Auto:
85 case Color.ColorType.Rgb:
86 value = color.RgbColor.StringValue;
88 case Color.ColorType.Indexed:
89 value = color.IndexedColor.StringValue;
91 case Color.ColorType.Theme:
92 value = color.ThemeColor.StringValue;
94 case Color.ColorType.System:
95 value = color.SystemColor.StringValue;
106 public string GetTintAttributeValue(Color color)
108 if (!color.Tint.HasValue)
112 double tint = color.Tint.Value;
113 return tint == 0.0 ? null : ParserUtils.ToString(tint);
121 public bool UseTintAttribute(Color color)
123 return color !=
null && color.Type == Color.ColorType.Theme && (!color.Tint.HasValue || !Comparators.IsZero(color.Tint.Value));