ColorBlend
- blends (mixes) two colors

Indicators
(AmiBroker 5.30)


SYNTAX ColorBlend( colorFrom, colorTo, factor = 0.5 )
RETURNS NUMBER
FUNCTION The function blends (mixes) colorFrom with colorTo with 'factor' proportion using the following algorithm

RGB = ( 1 - factor ) * RGB(colorFrom) + factor * RGB(colorTo );

So factor = 0 means use colorFrom only, factor = 1 means use colorTo only. All in-between values mean create mix of colors. The lower the factor value means more colorFrom.

EXAMPLE

This function makes it easy to lighten or darken colors like this:

function ColorLighten( color )
{
 return ColorBlend( color, colorWhite, 0.5 );
}

function ColorDarken( color )
{
 return ColorBlend( color, colorBlack, 0.5 );
}

SEE ALSO ColorRGB() function , ColorHSB() function

References:

The ColorBlend function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.