Palette

Description:              This statement allows the color assignment for a color number to be changed, provided that Windows™ is running in 256 Color Mode.

Returns:                    Nothing

Usage:                       Script or Steady State

Format:                      Palette(Index, Red, Green, Blue)

Parameters:             Index    { numeric }  { required }  { no default }

                                      Any numeric expression giving the color number to be set. The colors 0 - 15, 243, 247, 248 and 252 may not be altered.

                                    Red    { numeric }  { required }  { no default }

                                      Any numeric expression giving the new red content to use for the Index color. A value of 0 indicates that no red will be included in the color. Increasing values of Red will increase the brightness of the red content of the Index color. Red must be in the range 0 to 1.

                                    Green    { numeric }  { required }  { no default }

                                      Any numeric expression giving the new green content to use for the Index color. A value of 0 indicates that no green will be included in the color. Increasing values of Green will increase the brightness of the green content of the Index color. Green must be in the range 0 to 1.

                                    Blue    { numeric }  { required }  { no default }

                                      Any numeric expression giving the blue content to use for the Index color. A value of 0 indicates that no blue will be included in the color. Increasing values of Blue will increase the brightness of the blue content of the Index color. Blue must be in the range 0 to 1.

Comments:               The video display colors are composed of three primary colors: red, green and blue (this differs greatly from the world of paints and pigments, where the three primary colors are red, yellow and blue). Any given display adapter will support only a finite number of brightness levels for each of the three colors. For example, an IBM EGA adapter supports four brightness levels for each of the three colors. To determine the number of brightness levels for a given board, take the cube root of the number of colors in the palette. For example, if the display board supports 262,144 colors in the palette, the number of brightness levels for each color is 64 (the cube root of 262,144).

                             If the display adapter does not support palette capability, the statement has no effect. The changing of a color index to a new color will result in an immediate change on the screen of all areas using that color. This function is often used to control the exact colors available for use.

                             Since the colors for each index do not have to be unique, this function can be used to create special effects. For example, if an image were drawn in one color, it could be changed to the background color by a Palette statement and then immediately turned "on" by another Palette statement when a variable changed value. This technique can be used to create flashing areas on the screen. (See warning below.)

                             VTS changes the video board's palette registers immediately upon execution of this command, without waiting for a vertical retrace interrupt. Some video cards abort a vertical retrace when this happens. This will cause a faint flickering of the video screen.

            NOTE: Once the settings for a certain color index have been changed, they are permanently set to those colors! The only way to revert back to the original color is to save the original settings, as in the example, below and to do another Palette statement to set that particular color index back to its old settings.

Example:

oldRed = PalStatus(16, 0 { Amount of red });

oldGreen = PalStatus(16, 1 { Amount of green });

oldBlue = PalStatus(16, 2 { Amount of blue });

Palette(16, 0.8, 0, 0.5);

...

Palette(16, oldRed, oldGreen, oldBlue);

This checks the color mix for color index 16, changes it to a rose color, then eventually changes it back to its original color.

See Also:

PalStatus