SetPalette (procedure) (Graph unit)


 SetPalette (procedure)     (Graph unit)

Changes one palette color as specified by ColorNum and Color.


 procedure SetPalette(ColorNum: Word; Color: Shortint);


Real, Protected


Changes the ColorNum entry in the palette to Color. SetPalette(0, LightCyan) makes the first color in the palette light cyan. ColorNum can range from 0 to 15, depending on the current graphics driver and current graphics mode. If invalid input is passed to SetPalette, GraphResult returns a value of grError, and the palette remains unchanged.

Changes made to the palette are seen immediately onscreen. In the example here, several lines are drawn onscreen, then the palette is changed ran-dom-ly. Each time a palette color is changed, all onscreen occurrences of that color will be changed to the new color value. See Color constants for a list of defined color constants.


Must be in graphics mode, and can be used only with EGA, EGA 64, or VGA (not the IBM 8514).

See Also

Sample Code

Тэги: SetPalette
| G+
Код для вставки: :: :: :: ::
Поделиться: // //