Skip to content

Commit

Permalink
Merge pull request sass#2950 from nschonni/fix--throw-on-weitht-passe…
Browse files Browse the repository at this point in the history
…d-to-CSS3-invert

fix: throw on weitht passed to CSS3 invert()
  • Loading branch information
nschonni committed Jul 26, 2019
2 parents 996dbb3 + d972c50 commit 6ea4cb2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fn_colors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,16 @@ namespace Sass {
{
// CSS3 filter function overload: pass literal through directly
Number* amount = Cast<Number>(env["$color"]);
double weight = DARG_U_PRCT("$weight");
if (amount) {
// TODO: does not throw on 100% manually passed as value
if (weight < 100.0) {
error("Only one argument may be passed to the plain-CSS invert() function.", pstate, traces);
}
return SASS_MEMORY_NEW(String_Quoted, pstate, "invert(" + amount->to_string(ctx.c_options) + ")");
}

Color* col = ARG("$color", Color);
double weight = DARG_U_PRCT("$weight");
Color_RGBA_Obj inv = col->copyAsRGBA();
inv->r(clip(255.0 - inv->r(), 0.0, 255.0));
inv->g(clip(255.0 - inv->g(), 0.0, 255.0));
Expand Down

0 comments on commit 6ea4cb2

Please sign in to comment.