Add two or more colors, MODIFIES FIRST ARGUMENT
@param {number[]} color1
@param {number[]} color2
@returns {number[]}
7345
function(color1, color2) {
		for (var i=0;i<3;i++) {
			for (var j=1;j<arguments.length;j++) {
				color1[i] += arguments[j][i];
			}
		}
		return color1;
	}
929178
public static Color lerpColor(ColorSet colorSet1, ColorSet colorSet2, double amt) {
         return lerpColor((HSBColor)HSBColor.color(colorSet1), (HSBColor)HSBColor.color(colorSet2), amt);
    }
35580
function(color, alpha){
      var args;
      if (2 == arguments.length) {
        var c = parse(color.trim());
        args = [c.r, c.g, c.b, alpha];
      } else {
        args = [].slice.call(arguments);
      }

      return 'rgba(' + args.join(', ') + ')';
    }
309297
function hueshiftColor(col, amount) {
  let colRgba = parseColor(col);
  let colHsla = rgbaToHsla(colRgba.r, colRgba.g, colRgba.b, colRgba.a);
  colRgba = hslaToRgba((hsl[0] + amount) % 1, colHsla[1], colHsla[2],colHsla[3]);
  return RGBobj2string({
    r: colRgba[0],
    g: colRgba[1],
    b: colRgba[2],
    a: colRgba[3]
  });
}
184035
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);
    }
434182
def +(color2)
    Color.new(
      (self.red + color2.red) / 2.0,
      (self.green + color2.green) / 2.0,
      (self.blue + color2.blue) / 2.0
    )
  end
1308573
function merge(src1, src2) {
    var merged = {};
    extend(merged, src1);
    extend(merged, src2);
    return merged;
}
1350901
def _mix(color1, color2, weight=0.5, **kwargs):
    
    weight = float(weight)
    c1 = color1.value
    c2 = color2.value
    p = 0.0 if weight < 0 else 1.0 if weight > 1 else weight
    w = p * 2 - 1
    a = c1[3] - c2[3]

    w1 = ((w if (w * a == -1) else (w + a) / (1 + w * a)) + 1) / 2.0
    w2 = 1 - w1
    q = [w1, w1, w1, p]
    r = [w2, w2, w2, 1 - p]
    return ColorValue([c1[i] * q[i] + c2[i] * r[i] for i in range(4)])
366701
public void setColorGradient(ColorRgba color1, ColorRgba color2)
    {
        setColorGradient(x, y, color1, x + maxWidth, y + maxHeight, color2);
    }
66080
def get_color_between(color1, color2, i):
    
    if i <= 0:
        return color1
    if i >= 1:
        return color2
    return (int(color1[0] + (color2[0] - color1[0]) * i),
            int(color1[1] + (color2[1] - color1[1]) * i),
            int(color1[2] + (color2[2] - color1[2]) * i))
517424
function colorBlend(mode, color1, color2) {
    var ab = color1.alpha, cb, // backdrop
        as = color2.alpha, cs, // source
        ar, cr, r = [];        // result

    ar = as + ab * (1 - as);
    for (var i = 0; i < 3; i++) {
        cb = color1.rgb[i] / 255;
        cs = color2.rgb[i] / 255;
        cr = mode(cb, cs);
        if (ar) {
            cr = (as * cs + ab * (cb
                - as * (cb + cs - cr))) / ar;
        }
        r[i] = cr * 255;
    }

    return new(tree.Color)(r, ar);
}
950808
public function getBrightnessDifference($color1, $color2): float
    {
        return Plugin::$plugin->color->getBrightnessDifference($color1, $color2);
    }
1191713
def mix(color1, color2, pos=0.5):
    
    opp_pos = 1 - pos

    red = color1[0] * pos + color2[0] * opp_pos
    green = color1[1] * pos + color2[1] * opp_pos
    blue = color1[2] * pos + color2[2] * opp_pos
    return int(red), int(green), int(blue)
921146
function ( color ) {
            var rgba = {};
            color.replace( this.REG_RGB, function ( str, r, g, b, a ) {
                rgba = {r: Number(r), g: Number(g), b: Number(b), a: 1};
                if ( a ) rgba.a = Number(a);
            });
            return rgba;
        }
966701
def +(other)
      rgb =
        case other
        when RGB
          compound_by(other.rgb) { |a, b| [a+b, 255].min }
        when Array
          raise ArgumentError, "Invalid size of Array given" unless other.size==3
          compound_by(other) { |a, b| (a + b) % 256 }
        when Integer
          compound_by([other] * 3) { |a, b| (a + b) % 256 }
        else
          raise ArgumentError, "Invalid argument given"
        end
      self.class.new *rgb
    end
887482
function fromLab(l, a, b) {
    var color = create();
    setLab(color, l, a, b);
    return color;
}
628463
function( num ){
           var list = new ColorList();
           for( var i = 0; i < num; i++) {
               list.add( this.getColor() );
            }
           return list;
        }