COLOR.BAS

Color is an example of an application that can be used as an aid for developing programs. I demonstrates how the background and text will look in a running GWBasic program using the COLOR f,b    statement wheref and b are the colors of the foreground and background colors.

Line 60 is an environmental pair of instructions that clear the screen and turn off the KEY menu.

Line 100 and 130 control the nested FOR NEXT statements
 The B loop is done 8 times with variable B using the numbers 0 through 7
   This is done within the F loop 17 times useing values 0 through 16 for the value of F
     After each B loop, a PRINT statement is done before the next F loop.

Line 110 plugs each current value of F and B into the COLOR statement in turn.
Line 120 prints a short string using these values of F and B in the COLOR statement.
 This results in a short string being posted for B times in a line
   followed by the PRINT statement that advances to the next line
    and repeated for a total of 17 lines.
     each posting demonstrates the F and B value to be used in a COLOR statement.

Line 120 prints and prepares each of the segments of text to the screen.
  The numeric variables F and B are converted into ASCII characters with the STR$(n) instruction
    the F$ and B$ characters are seperated with a "," character and a large number of spaces is added
     then the LEFT$ statement uses only the 8 leftmost characters in the string
      the PRINT statement outputs the final string in the color dictated by line 110
       the semi-color at the end of the string expression supresses the carriage return.

Line 150  restores the color back to the default values of 7 and 0 for the fore and background.

So.... if you want to use the COLOR statement in your program to see something besides the
white on black screen, then this will show you what colors to use in your COLOR statement.


10 '              prog color
20 '
30 '
40 '
50 '
60 KEY OFF: CLS
70 PRINT " the color statement COLOR F,B "
80 PRINT " where F= foreground and B= background "
90 '
100 FOR F= 0 TO 16: FOR B=0 TO 7
110     COLOR F,B
120    PRINT LEFT$( STR$(F)+","+STR$(B)+"     ",8);
130 NEXT B: PRINT: NEXT F
140 '
150 COLOR 7,0
160 PRINT" Row 16 to 31 repeats with blinking "
170 '
180 END
190 SAVE "color",A