lib/less/functions/color.js
function (color1, color2, weight) {
        if (!color1.toHSL || !color2.toHSL) {
            console.log(color2.type);
            console.dir(color2);
        }
        if (!weight) {
            weight = new 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 Color(rgb, alpha);
    }
function (color1, color2, weight) {
        if (!color1.toHSL || !color2.toHSL) {
            console.log(color2.type);
            console.dir(color2);
        }
        if (!weight) {
            weight = new 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 Color(rgb, alpha);
    }
function ( color1 , color2 , weight ) { if ( ! color1 . toHSL || ! color2 . toHSL ) { console . log ( color2 . type ) ; console . dir ( color2 ) ; } if ( ! weight ) { weight = new 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 Color ( rgb , alpha ) ; }
Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein http://sass-lang.com
Copyright ( c ) 2006 - 2009 Hampton Catlin Natalie Weizenbaum and Chris Eppstein http : // sass - lang . com