COLOR statement

Purpose: Sets the foreground and background color creen attributes.


 Syntax:

 COLOR fg_color, bg_color

 Parameters:

  • fg_color Integer from 0 to 15, the color of the text.
  • bg_color Integer from 0 to 15, the color of the screen.

Remarks: The COLOR statement will work only in console mode programs.

Example: Demonstrates all possible console color combinations.


 DIM b%
 DIM f%
 FOR b% = 0 TO 15
   FOR f% = 0 TO 15
    COLOR f%, b%
    PRINT "o";
   NEXT
  COLOR 7, 0
  PRINT
 NEXT

BCX Console Sample Programs using COLOR statement.

S00.bas, S35.bas, S38.bas, S40.bas, S41.bas, S77.bas, S100.bas, S105.bas, S111.bas, S119.bas, S120.bas, S135.bas

COLOR_BG and COLOR_FG variables

Purpose: The BCX variables COLOR_BG and COLOR_FG each contain the integer value of the current console mode BACKGROUND(the color of the screen) and FOREGROUND(the color of the text) colors, respectively.