QBasic 1.1: PALETTE Statement
Explanation
PALETTE, PALETTE USING Statements
Change the color assignments of color attributes in the current screen mode. PALETTE and PALETTE USING work only on systems equipped with EGA, VGA, or MCGA adapters.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
PALETTE [attribute%,color&] |
PALETTE USING arrayname#[(index%)] |
Description / Parameter(s)
attribute% |
The color attribute to change. |
color& |
A color value to assign to an attribute. |
arrayname# |
An array of color values to assign to the current screen mode's set of attributes. The array must be large enough to assign colors to all the attributes. |
index% |
The index of the first array element to assign to an attribute. |
The available color attributes and values depend on your graphics adapter and the screen mode set by the most recent SCREEN statement. |
Example
'This example requires a color graphics adapter.
PALETTE 0, 1
SCREEN 1
FOR i% = 0 TO 3: a%(i%) = i%: NEXT i%
LINE (138, 35)-(288, 165), 3, BF
LINE (20, 10)-(160, 100), 2, BF
DO
FOR i% = 0 TO 3
a%(i%) = (a%(i%) + 1) MOD 16
NEXT i%
PALETTE USING a%(0)
LOOP WHILE INKEY$ = ""