qb45advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
COLOR Statement Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
COLOR Statement Programming Example
 
The following series of examples show COLOR statements and their
effects in the various screen modes:
 
'*** Programming example for COLOR statement***
SCREEN 0            'text mode only
'foreground = 1 (blue), background = 2 (green), border = 3 (cyan)
'EGA and VGA boards do not support the border argument
COLOR  1, 2, 3
CLS
LOCATE 12,25: PRINT "Press any key to continue..."
DO
LOOP WHILE INKEY$ = ""
SCREEN 1            'set screen to 320 x 200 graphics
'background = 1 (blue), foreground = even palette number (red, green, yellow)
COLOR  1, 0
LINE (20, 20) - (300, 180), 3, B       'draw a box
LOCATE 12,7: PRINT "Press any key to continue..."
DO
LOOP WHILE INKEY$ = ""
'background = 2 (green), foreground = odd palette (white, magenta, cyan)
COLOR  2, 1
LINE (20, 20) - (300, 180), 3, B       'draw a box
LOCATE 12,7: PRINT "Press any key to continue..."
DO
LOOP WHILE INKEY$ = ""
SCREEN 0            'set screen to text mode
'foreground = 7 (white), background = 0 (black), border = 0 (black)
COLOR 7, 0, 0
CLS
END