Contents of the COLORS.DOC file
COLORS.BAS is a QuickBASIC $INCLUDE file which provides a simple way for
your program to allow the user to set screen colors, and save that set to
disk as a default when running the program.
It consists of two subroutines, COLORSET: and COLORINIT:. COLORINIT:
reads the file COLOR.DAT, which is created by COLORSET:. That file
contains numbers for the variables FG and BG (forground, background).
If COLOR.DAT does not exist, an error-handling routine sets the default
colors to 2,0 (Green on Black.)
GOSUB COLORINIT should appear early in your main program, right after
your DEF statements.
COLORSET: displays a selection chart of available colors, then asks for a
choice from the user. Once the choices of FG and BG are made, the chosen
pair appear, and the user is asked to confirm the choice. If they don't
confirm, the color selection chart re-appears.
If they confirm their choice, a prompt asks whether the user wants to
save the selection as the program default. On a "Y" or "y" answer,
COLORSET: writes the selection to COLOR.DAT. If the answer is "N" or "n".
the program returns to the calling routine.
GOSUB COLORSET can appear anywhere you want in your program. I usually
include it in the program's main or initial menu, for simplicity.
Include the file in your program with the line:
REM $INCLUDE: "[PATH]COLORS.BAS"
Once included, you can use the variables FG and BG to set screen colors.
COLOR FG,BG sets normal colors.
COLOR BG,FG sets reverse.
COLOR FG+16,BG sets flashing text.
You get the idea.
C -- used in FOR--NEXT loops within subroutine.
ANS$ -- used to get user response.
SAVE$ -- used to get user response.
FG -- Foreground color number.....output
BG -- Background color number.....output
COLORS.BAS was written for QuickBASIC, Version 3.0, but should operate
properly with any version of QuickBASIC.
COLORS.BAS is shareware, sort of. If you use it in a public domain program,
you need not register COLORS.BAS. If you use the routines in a shareware
program, you must register it for a one-time fee of $5.
If COLORS.BAS is used in a commercial program, which will be distributed in
stores or sold for a flat fee of any size, you must register it for a one-time
fee of $100.
That's simple enough.
I've included a simple program that demonstrates and tests COLORS. It's
TESTCOLR.BAS. You can use QB to run this to see what's happening. You may
have to change the last line to indicate where COLORS.BAS is on your hard
COLORS.BAS is copyright, 1988, by George Campbell.
Send registration fees to:
1472 Sixth St.
Los Osos, CA 93402
SLO BYTES BBS
(805) 528-3753 300-2400 8,N,1