HOW TO CHANGE CURRENT PRINTING COLOR IN QBASIC ?
To change the current printing color, use the COLOR statement.
COLOR 7,0 'Uses the default white on black.
COLOR 15,0 'Bright white on black.
COLOR 0,1 'Black on blue
COLOR 14,0 'Bright yellow.
'COLOR CODES FOR QBASIC ARE AS FOLLOW:
0 - BLACK
1 - BLUE
2 - GREEN
3 - CYAN
4 - RED
5 - PURPLE
6 - BROWN/ORANGE
7 - LIGHT GREY (WHITE)
8 - GRAY
9 - LIGHT BLUE
10 - LIGHT GREEN
11 - LIGHT CYAN
12 - LIGHT RED
13 - LIGHT PURPLE
14 - YELLOW (LIGHT ORANGE)
15 - WHITE (LIGHT WHITE)
If you look carefully at the chart you can see that there are 8 main colors (0 through 7) and then those colors repeat, each in a lighter shade. You may also notice that the colors act as a combination of binary values (where blue=1, green=2, red=4, etc.) This makes it much easier to memorize the color scheme. Blinking colors are also available: at 16, the colors start over again with blinking black and extend through 31 (blinking white). However, the blinking option is not available for the background, only for the text (foreground). Add 16 to the color you wish to blink. e.g.: 2+16=18 - Blinking Green, 4+16=20 - Blinking Red. It is possible to switch the blinking foreground text with an intense background, but this task is beyond the scope of this QBasic textbook, and may not work when MS Windows displays the console in a windowed mode.
0 Comments