public IEnumerable <ISmartTagAction> GetSmartTagActions(ParseItem item, int position, ITrackingSpan itemTrackingSpan, ITextView view) { TokenItem token = (TokenItem)item; if (!token.IsValid || token.TokenType != CssTokenType.Identifier || token.FindType <Declaration>() == null || !(item.StyleSheet is ScssStyleSheet)) { yield break; } var color = Color.FromName(token.Text); if (color.IsKnownColor) { yield return(new LessExtractVariableSmartTagAction(itemTrackingSpan, item, "$")); } }
public IEnumerable <ISmartTagAction> GetSmartTagActions(ParseItem item, int position, ITrackingSpan itemTrackingSpan, ITextView view) { TokenItem token = (TokenItem)item; if (!token.IsValid || token.TokenType != CssTokenType.Identifier || token.FindType <Declaration>() == null) { yield break; } var color = Color.FromName(token.Text); if (color.IsNamedColor) { ColorModel model = ColorParser.TryParseColor(token.Text, ColorParser.Options.AllowNames); if (model != null) { yield return(new ColorConverterSmartTagAction(itemTrackingSpan, model, ColorFormat.RgbHex3)); yield return(new ColorConverterSmartTagAction(itemTrackingSpan, model, ColorFormat.Rgb)); yield return(new ColorConverterSmartTagAction(itemTrackingSpan, model, ColorFormat.Hsl)); } } }