Multiply (mix) two or more colors, MODIFIES FIRST ARGUMENT
@param {number[]} color1
@param {number[]} color2
@returns {number[]}
339710
function(color1, color2) {
		for (var i=0;i<3;i++) {
			for (var j=1;j<arguments.length;j++) {
				color1[i] *= arguments[j][i] / 255;
			}
			color1[i] = Math.round(color1[i]);
		}
		return color1;
	}
1342881
function ( array1, array2 ) {
		var result = [];

		array.each( array1, function ( i ) {
			if ( !array.contains( array2, i ) ) {
				array.add( result, i );
			}
		});

		array.each( array2, function ( i ) {
			if ( !array.contains( array1, i ) ) {
				array.add( result, i );
			}
		});

		return result;
	}
873710
function mergeDeepArrays(array1, array2) {
  const length = Math.max(array1.length, array2.length);

  let index = -1,
      mergedArray = [];

  while (++index < length) {
    if (index < array2.length) {
      mergedArray[index] = getDeeplyMergedValues(array1[index], array2[index]);

      continue;
    }

    mergedArray[index] = array1[index];
  }

  return mergedArray;
}
1291136
public function merge(Color $color1, Color $color2, $percentage = 50)
    {
        return new Color(array(
            'red' => $this->getMergedColorPart('red', $color1, $color2, $percentage),
            'green' => $this->getMergedColorPart('green', $color1, $color2, $percentage),
            'blue' => $this->getMergedColorPart('blue', $color1, $color2, $percentage)
        ));
    }
827825
def _sim_colour(r1, r2):
    
    return sum([min(a, b) for a, b in zip(r1["hist_c"], r2["hist_c"])])
599656
public static function lumosity_difference( $color_1 = '#ffffff', $color_2 = '#000000' ) {
		$color_1 = self::sanitize_hex( $color_1, false );
		$color_2 = self::sanitize_hex( $color_2, false );
		$color_1_rgb = self::get_rgb( $color_1 );
		$color_2_rgb = self::get_rgb( $color_2 );
		$l1 = 0.2126 * pow( $color_1_rgb[0] / 255, 2.2 ) + 0.7152 * pow( $color_1_rgb[1] / 255, 2.2 ) + 0.0722 * pow( $color_1_rgb[2] / 255, 2.2 );
		$l2 = 0.2126 * pow( $color_2_rgb[0] / 255, 2.2 ) + 0.7152 * pow( $color_2_rgb[1] / 255, 2.2 ) + 0.0722 * pow( $color_2_rgb[2] / 255, 2.2 );
		$lum_diff = ( $l1 > $l2 ) ? ( $l1 + 0.05 ) / ( $l2 + 0.05 ) : ( $l2 + 0.05 ) / ( $l1 + 0.05 );
		return round( $lum_diff, 2 );
	}
785761
public static Expression mix(Generator generator, FunctionCall input) {
        Color color1 = input.getExpectedColorParam(0);
        Color color2 = input.getExpectedColorParam(1);
        float weight = input.getParameters().size() > 2 ? input.getExpectedFloatParam(2) : 0.5f;
        return new Color((int) Math.round(color1.getR() * weight + color2.getR() * (1.0 - weight)),
                         (int) Math.round(color1.getG() * weight + color2.getG() * (1.0 - weight)),
                         (int) Math.round(color1.getB() * weight + color2.getB() * (1.0 - weight)),
                         (float) (color1.getA() * weight + color2.getA() * (1.0 - weight)));
    }
990702
function ( color ) {
		var digits, red, green, blue, result, i, nth;

		if ( color.charAt( 0 ) === "#" ) {
		    result = color;
		}
		else {
			digits = string.explode( color.replace( /.*\(|\)/g, "" ) );
			red    = number.parse( digits[0] || 0 );
			green  = number.parse( digits[1] || 0 );
			blue   = number.parse( digits[2] || 0 );
			result = ( blue | ( green << 8 ) | ( red << 16 ) ).toString( 16 );

			if ( result.length < 6 ) {
				nth = number.diff( result.length, 6 );
				i   = -1;

				while ( ++i < nth ) {
					result = "0" + result;
				}
			}

			result = "#" + result;
		}

		return result;
	}
678008
def blend_color(color, color2):
    """"""
    r1, g1, b1 = hex_to_rgb(color)
    r2, g2, b2 = hex_to_rgb(color2)

    r3 = int(0.5 * r1 + 0.5 * r2)
    g3 = int(0.5 * g1 + 0.5 * g2)
    b3 = int(0.5 * b1 + 0.5 * b2)

    return rgb_to_hex((r3, g3, b3))
506978
function (size, unitSize, color1, color2) {
        size = size || 512;
        unitSize = unitSize || 64;
        color1 = color1 || 'black';
        color2 = color2 || 'white';

        var repeat = Math.ceil(size / unitSize);

        var canvas = document.createElement('canvas');
        canvas.width = size;
        canvas.height = size;
        var ctx = canvas.getContext('2d');
        ctx.fillStyle = color2;
        ctx.fillRect(0, 0, size, size);

        ctx.fillStyle = color1;
        for (var i = 0; i < repeat; i++) {
            for (var j = 0; j < repeat; j++) {
                var isFill = j % 2 ? (i % 2) : (i % 2 - 1);
                if (isFill) {
                    ctx.fillRect(i * unitSize, j * unitSize, unitSize, unitSize);
                }
            }
        }

        var texture = new Texture2D({
            image: canvas,
            anisotropic: 8
        });

        return texture;
    }
33600
function(r, g, b, a) {
    var rgb = [r, g, b].map(function (c) { return number(c); });
    a = number(a);
    if (rgb.some(isNaN) || isNaN(a)) return null;
    rgb.push(a);
    return rgb;
  }
64739
function(color, alpha) {
            color = color.toRGB();
            alpha = Math.min(Math.max(alpha, 0), 1);
            var rgb = this.clone();

            rgb.red = (rgb.red * (1 - alpha)) + (color.red * alpha);
            rgb.green = (rgb.green * (1 - alpha)) + (color.green * alpha);
            rgb.blue = (rgb.blue * (1 - alpha)) + (color.blue * alpha);
            rgb.alpha = (rgb.alpha * (1 - alpha)) + (color.alpha * alpha);

            return rgb;
        }
436923
public function cie94($color1, $color2)
    {
        $Kl = 1.0;
        $K1 = .045;
        $K2 = 0.015;

        $Kc = 1.0;
        $Kh = 1.0;

        $f1 = $this->toLab($color1);
        $f2 = $this->toLab($color2);

        $deltaL = $f2->l - $f1->l;
        $deltaA = $f2->a - $f1->a;
        $deltaB = $f2->b - $f1->b;

        $c1 = sqrt($f1->a * $f1->a + $f1->b * $f1->b);
        $c2 = sqrt($f2->a * $f2->a + $f2->b * $f2->b);
        $deltaC = $c2 - $c1;

        $deltaH = $deltaA * $deltaA + $deltaB * $deltaB - $deltaC * $deltaC;
        $deltaH = $deltaH < 0 ? 0 : sqrt($deltaH);

        $Sl = 1.0;
        $Sc = 1 + $K1 * $c1;
        $Sh = 1 + $K2 * $c1;

        $deltaLKlsl = $deltaL / ($Kl * $Sl);
        $deltaCkcsc = $deltaC / ($Kc * $Sc);
        $deltaHkhsh = $deltaH / ($Kh * $Sh);

        $deltaE = $deltaLKlsl * $deltaLKlsl + $deltaCkcsc * $deltaCkcsc + $deltaHkhsh * $deltaHkhsh;

        return $deltaE < 0 ? 0 : sqrt($deltaE);
    }
52398
function(color1, color2, amount) {
    var p = amount / 100.0;
    var w = p * 2 - 1;
    var hsl1 = this.toHSL(color1);
    var hsl2 = this.toHSL(color2);
    var a = hsl1.a - hsl2.a;

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

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

    var alpha = color1[3] * p + color2[3] * (1 - p);
    rgb[3] = alpha;
    return rgb;
  }
1002652
def interp_color(a, b, f):
    
    a_ = (a.redF(), a.greenF(), a.blueF())
    b_ = (b.redF(), b.greenF(), b.blueF())
    a_ = [x * (1 - f) for x in a_]
    b_ = [x * f for x in b_]
    c = [x + y for x, y in zip(a_, b_)]
    return QtGui.QColor.fromRgbF(*c)
151337
public Color multiply(Color c) {
		return new Color(r * c.r, g * c.g, b * c.b, a * c.a);
	}
594763
private double doubleValueRightColor( double left, double color ) {
        return rgba( doubleValue( left, red( color ) ), //
                        doubleValue( left, green( color ) ), //
                        doubleValue( left, blue( color ) ), 1 );
    }