addColorsMod

Help Contents Graphics Direct Graphics addColorsMod
addColors getColorDatabase

resultingColor addColorsMod c1 c2


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

The colors are added channelwise (R,G,B,A) while keeping the channels in the allowed range by using mod, like in the following logo procedure, but faster:

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

Example:

reRGBA addColorsMod RGB .8 .9 1 RGB .3 .4 .5
;[0.0941176 0.294118 0.494118 1]

Reference:

addColors getColorDatabase