* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.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
* * ** * * * *