function (color1, color2, weight) {
        if (!weight) {
            weight = new(tree.Dimension)(50);
        }
        var p = weight.value / 100.0;
        var w = p * 2 - 1;
        var a = color1.toHSL().a - color2.toHSL().a;

        var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
        var w2 = 1 - w1;

        var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
                   color1.rgb[1] * w1 + color2.rgb[1] * w2,
                   color1.rgb[2] * w1 + color2.rgb[2] * w2];

        var alpha = color1.alpha * p + color2.alpha * (1 - p);

        return new(tree.Color)(rgb, alpha);
    }
function (color1, color2, weight) {
        if (!weight) {
            weight = new(tree.Dimension)(50);
        }
        var p = weight.value / 100.0;
        var w = p * 2 - 1;
        var a = color1.toHSL().a - color2.toHSL().a;

        var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
        var w2 = 1 - w1;

        var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
                   color1.rgb[1] * w1 + color2.rgb[1] * w2,
                   color1.rgb[2] * w1 + color2.rgb[2] * w2];

        var alpha = color1.alpha * p + color2.alpha * (1 - p);

        return new(tree.Color)(rgb, alpha);
    }
function ( color1 , color2 , weight ) { if ( ! weight ) { weight = new ( tree . Dimension ) ( 50 ) ; } var p = weight . value / 100.0 ; var w = p * 2 - 1 ; var a = color1 . toHSL ( ) . a - color2 . toHSL ( ) . a ; var w1 = ( ( ( w * a == - 1 ) ? w : ( w + a ) / ( 1 + w * a ) ) + 1 ) / 2.0 ; var w2 = 1 - w1 ; var rgb = [ color1 . rgb [ 0 ] * w1 + color2 . rgb [ 0 ] * w2 , color1 . rgb [ 1 ] * w1 + color2 . rgb [ 1 ] * w2 , color1 . rgb [ 2 ] * w1 + color2 . rgb [ 2 ] * w2 ] ; var alpha = color1 . alpha * p + color2 . alpha * ( 1 - p ) ; return new ( tree . Color ) ( rgb , alpha ) ; }
Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein http://sass-lang.com
Copyright ( c ) 2006 - 2009 Hampton Catlin Nathan Weizenbaum and Chris Eppstein http : // sass - lang . com
Returns a new color