IsColorName() public static method

public static IsColorName ( string cssText ) : bool
cssText string
return bool
Esempio n. 1
0
 public static CssPrimitiveValue Create(Match match, bool readOnly)
 {
     if (match.Groups["length"].Success)
     {
         return(new CssPrimitiveLengthValue(match.Groups["lengthNumber"].Value, match.Groups["lengthUnit"].Value, readOnly));
     }
     if (match.Groups["angle"].Success)
     {
         return(new CssPrimitiveAngleValue(match.Groups["angleNumber"].Value, match.Groups["angleUnit"].Value, readOnly));
     }
     if (match.Groups["funcname"].Success)
     {
         var funcValue = match.Groups["funcname"].Value;
         if (string.Equals(funcValue, "rgb", StringComparison.OrdinalIgnoreCase) ||
             string.Equals(funcValue, "rgba", StringComparison.OrdinalIgnoreCase) ||
             string.Equals(funcValue, "hsl", StringComparison.OrdinalIgnoreCase) ||
             string.Equals(funcValue, "hsla", StringComparison.OrdinalIgnoreCase))
         {
             return(new CssPrimitiveRgbValue(match.Groups["func"].Value, readOnly));
         }
         if (string.Equals(funcValue, "var", StringComparison.OrdinalIgnoreCase))
         {
             return(new CssPrimitiveVarsValue(match.Groups["func"].Value, readOnly));
         }
     }
     if (match.Groups["colorIdent"].Success && CssPrimitiveRgbValue.IsColorName(match.Groups["colorIdent"].Value))
     {
         return(new CssPrimitiveRgbValue(match.Groups["colorIdent"].Value, readOnly));
     }
     return(new CssPrimitiveValue(match, readOnly));
 }
Esempio n. 2
0
 public static CssPrimitiveValue Create(Match match, bool readOnly)
 {
     if (match.Groups["length"].Success)
     {
         return(new CssPrimitiveLengthValue(match.Groups["lengthNumber"].Value, match.Groups["lengthUnit"].Value, readOnly));
     }
     if (match.Groups["angle"].Success)
     {
         return(new CssPrimitiveAngleValue(match.Groups["angleNumber"].Value, match.Groups["angleUnit"].Value, readOnly));
     }
     if (match.Groups["funcname"].Success && match.Groups["funcname"].Value == "rgb")
     {
         return(new CssPrimitiveRgbValue(match.Groups["func"].Value, readOnly));
     }
     if (match.Groups["colorIdent"].Success && CssPrimitiveRgbValue.IsColorName(match.Groups["colorIdent"].Value))
     {
         return(new CssPrimitiveRgbValue(match.Groups["colorIdent"].Value, readOnly));
     }
     return(new CssPrimitiveValue(match, readOnly));
 }