File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,16 @@ namespace Sass {
1717 starts_with (str, " var(" );
1818 }
1919
20+ void hsla_alpha_percent_deprecation (const ParserState& pstate, const std::string val)
21+ {
22+
23+ std::string msg (" Passing a percentage as the alpha value to hsla() will be interpreted" );
24+ std::string tail (" differently in future versions of Sass. For now, use " + val + " instead." );
25+
26+ deprecated (msg, tail, false , pstate);
27+
28+ }
29+
2030 Signature rgb_sig = " rgb($red, $green, $blue)" ;
2131 BUILT_IN (rgb)
2232 {
@@ -211,6 +221,15 @@ namespace Sass {
211221 );
212222 }
213223
224+ Number_Ptr alpha = ARG (" $alpha" , Number);
225+ if (alpha && alpha->unit () == " %" ) {
226+ Number_Obj val = SASS_MEMORY_COPY (alpha);
227+ val->numerators .clear (); // convert
228+ val->value (val->value () / 100.0 );
229+ std::string nr (val->to_string (ctx.c_options ));
230+ hsla_alpha_percent_deprecation (pstate, nr);
231+ }
232+
214233 return SASS_MEMORY_NEW (Color_HSLA,
215234 pstate,
216235 ARGVAL (" $hue" ),
You can’t perform that action at this time.
0 commit comments