static XshtdColor ParseNamedColor(XmlReader reader, XshtdSyntaxDefinition syntax) { XshtdColor color = ParseColorAttributes(reader, syntax); // check removed: invisible named colors may be useful now that apps can read highlighting data //if (color.Foreground == null && color.FontWeight == null && color.FontStyle == null) // throw Error(reader, "A named color must have at least one element."); color.Name = reader.GetAttribute("name"); CheckElementName(reader, color.Name); color.ExampleText = reader.GetAttribute("exampleText"); return(color); }
static XshtdColor ParseColorAttributes(XmlReader reader, XshtdSyntaxDefinition syntax) { XshtdColor color = new XshtdColor(syntax); SetPosition(color, reader); IXmlLineInfo position = reader as IXmlLineInfo; color.Foreground = ParseColor(position, reader.GetAttribute("foreground")); color.Background = ParseColor(position, reader.GetAttribute("background")); color.FontWeight = ParseFontWeight(reader.GetAttribute("fontWeight")); color.FontStyle = ParseFontStyle(reader.GetAttribute("fontStyle")); color.Underline = reader.GetBoolAttribute("underline"); return(color); }