Using Color Table

  Previous  Next

Functions Provided For Using The Color Table

Some effects provide more than one color. In this case the so-called Color Table (described here), »Color Gradient, »Color Gradient Dialog or »M2L Color Table is offered by the effect to take control of the colors.

Color Table Feature

Color Table


The following table provides an overview of all functions the effect can use to modify the colors in a Color Table:



void ColorTableSetColor(int index, color c)

Sets the color with the specified index to the given color value. If the index is out of range, nothing happens.

color ColorTableGetColor(int index)

Returns the color with the specified index in the Color Table. If the index is out of range, black is returned.

int ColorTableGetColorCount()

Returns the current number of colors in the Color Table.

void ColorTableInvert()

Inverts the complete Color Table regarding the positions of the colors in the table.

void ColorTableSwapColors(int index1, int index2)

Swaps colors with their specified indices in the Color Table.

void ColorTableAddColor(int index, color c)

Adds another color to the Color Table at the specified index position. If the index is 0, the new color is added to the first position. If the index is equal to or greater than the current number of colors, the new color is added at the end.

void ColorTableRemoveColor(int index)

Removes the color at the specified index. If the given index is out of range, nothing happens.

void ColorTableSetColorFade(int fade)

Use 1 (TRUE) to activate the color Fade mode. Use 0 (FALSE) to deactivate it.

int ColorTableGetColorFade()

Returns 1 (TRUE) if the color Fade mode is activated, otherwise 0 (FALSE).

void ColorTableToggleColorFade()

Toggles the color Fade mode.

void ColorTableSetColorMode(int mode)

Sets the Color Mode. Please use a constant as described below for mode.

int ColorTableGetColorMode()

Returns the current Color Mode.


For a detailed description of the non-primitive data type color, see »Using Data Types



Not every function might be available for each MADRIX effect. Also, some MADRIX effects require at least 2 entries in the Color Table. You will not be able to overwrite this requirement with a Macro. In some MADRIX effects you cannot add or delete the number of colors, only the colors itself.


Color Mode Constants




The colors of the list will be used one after another in a loop.


The colors of the list will be used without a specific order.


The effect creates random colors.



This example ensures the amount of 6 colors in the Color Table and sets this 6 colors to defined values. The color fade and the loop mode are set. This example works with the »SCE Color Change or »SCE Color Scroll effect, for example.

color c1 = {255,0,0};        //red
color c2 = {0,255,0};        //green
color c3 = {0,0,255};        //blue
void InitEffect()
 //remove all colors from list until the amount of colors is 6
 while(ColorTableGetColorCount() > 6)
 //add colors to list until the amount of colors is 6
 while(ColorTableGetColorCount() < 6)
 //set colors        
 //activate color fade
 //set loop mode
void PreRenderEffect()
void PostRenderEffect()
void MatrixSizeChanged()

MADRIX Version: 5.5 | Script Version: 3.14
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
 Previous   Next


Enable automatic translation | Activer la traduction automatique |