Beans_Lessc::lib_mix PHP Method

lib_mix() protected method

http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method
protected lib_mix ( $args )
    protected function lib_mix($args)
    {
        if ($args[0] != "list" || count($args[2]) < 2) {
            $this->throwError("mix expects (color1, color2, weight)");
        }
        list($first, $second) = $args[2];
        $first = $this->assertColor($first);
        $second = $this->assertColor($second);
        $first_a = $this->lib_alpha($first);
        $second_a = $this->lib_alpha($second);
        if (isset($args[2][2])) {
            $weight = $args[2][2][1] / 100.0;
        } else {
            $weight = 0.5;
        }
        $w = $weight * 2 - 1;
        $a = $first_a - $second_a;
        $w1 = (($w * $a == -1 ? $w : ($w + $a) / (1 + $w * $a)) + 1) / 2.0;
        $w2 = 1.0 - $w1;
        $new = array('color', $w1 * $first[1] + $w2 * $second[1], $w1 * $first[2] + $w2 * $second[2], $w1 * $first[3] + $w2 * $second[3]);
        if ($first_a != 1.0 || $second_a != 1.0) {
            $new[] = $first_a * $weight + $second_a * ($weight - 1);
        }
        return $this->fixColor($new);
    }