BASIC Language Reference Manual > Command and Function Reference >



Changes the text foreground color that will be used by subsequent PRINT and INPUT statements.


TEXTCOLOR red intensity, green intensity, blue intensity

Remarks and Examples

The TEXTCOLOR command changes the color that will be used for the foreground of text that is written to the screen. When the text foreground color is set, all subsequent text commands use that foreground color, until you change the foreground color again.

A color is specified as a set of three component primary color intensity values: a value for the intensity of the red component, a value for the intensity of the blue component, and a value for the intensity of the green component. Intensity values can range between 0 (no color) and 255 (maximum intensity). This means that there are 256 * 256 * 256 = 16,777,216 possible colors.

For example, to set the foreground color to yellow, use a value of 255 for the intensity of red and green, and use a value of 0 for the intensity value of blue.

To change the text background color, use command TEXTBGCOLOR. Note that it is possible to set a combination of foreground and background colors that makes text unreadable.


100 TEXTBGCOLOR 50, 100, 50 : REM Set text background color to forest green
110 TEXTCOLOR 255, 255, 0 : REM Set text foreground color to yellow
120 CLS : REM Clear screen
130 PRINT "Here is some text with yellow text on a forest green background."
140 TEXTCOLOR 50, 230, 230
150 TEXTBGCOLOR 30, 30, 30
160 PRINT "Here is some sea green text on a dark gray background."

The color white can be obtained with values 255, 255, 255. The color black can be obtained with values 0, 0, 0.


Copyright 2006-2012, Kevin Matz, All Rights Reserved.