addColors

Help Contents Graphics Direct Graphics addColors
reHSBA addColorsMod

resultingColor addColors c1 c2


outputs the resultingColor which consists of the two colors color1 and color2.

The colors are added channelwise (R,G,B,A) with saturation like in the following logo procedure, but faster:

to addColors_ ca cb
	local [ra rb r g b]
	ra=reRGB ca
	rb=reRGB cb
	r=ra.1+rb.1 if r>1 [r=1]
	g=ra.2+rb.2 if g>1 [g=1]
	b=ra.3+rb.3 if b>1 [b=1]
	a=ra.4+rb.4 if a>1 [a=1]
	output RGBA r g b a
end

reRGBA addColors RGB .8 0 1 RGB .3 .4 .5
;[1 0.4 1 1]

References:

reHSBA addColorsMod