@@ -722,6 +722,24 @@ namespace Sass {
722722 break ;
723723 case Interpolant::ExpressionInterpolant:
724724 value = static_cast <Expression*>(itpl)->accept (this );
725+ if (warnForColor) {
726+ if (Color* color = value->isaColor ()) {
727+ ColorRgbaObj rgba = color->toRGBA ();
728+ double numval = rgba->r () * 0x10000
729+ + rgba->g () * 0x100 + rgba->b ();
730+ if (const char * disp = color_to_name (numval)) {
731+ sass::sstream msg;
732+ msg << " You probably don't mean to use the color value " ;
733+ msg << disp << " in interpolation here.\n It may end up represented " ;
734+ msg << " as " << rgba->inspect () <<" , which will likely produce invalid " ;
735+ msg << " CSS. Always quote color names when using them as strings or map " ;
736+ msg << " keys (for example, \" " << disp << " \" ). If you really want to " ;
737+ msg << " use the color value, append it to an empty string first to avoid " ;
738+ msg << " this warning (for example, '\"\" + " << disp << " ')." ;
739+ logger456.addWarning (msg.str (), itpl->pstate ());
740+ }
741+ }
742+ }
725743 value->accept (&cssize);
726744 break ;
727745 }
@@ -760,7 +778,7 @@ namespace Sass {
760778 SelectorListObj Eval::interpolationToSelector (Interpolation* itpl, bool plainCss, bool allowParent)
761779 {
762780 // Create a new source data object from the evaluated interpolation
763- SourceDataObj synthetic = interpolationToSource (itpl, false , true );
781+ SourceDataObj synthetic = interpolationToSource (itpl, true , true );
764782 // Everything parsed, will be parsed from perspective of local content
765783 // Pass the source-map in for the interpolation, so the scanner can
766784 // update the positions according to previous source-positions
0 commit comments