BASIC Language Reference Manual > Command and Function Reference >



Changes the graphics pen color that will be used by subsequent graphics primitives commands.


PENCOLOR red intensity, green intensity, blue intensity

Remarks and Examples

The graphics primitives commands (BOX, BAR, CIRCLE, LINE) draw shapes to the screen using the current graphics pen color. The PENCOLOR command can be used to set the graphics pen color. When the pen color is set, all subsequent graphics primitives commands use that color, until you change the pen 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 pen 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.


100 CLS
110 PENCOLOR 255, 255, 0 : REM Set pen graphics color to yellow
120 CIRCLE 300, 300, 100 : REM Draw a circle in yellow
130 LINE 100, 300, 500, 100 : REM Draw a line in yellow
140 PENCOLOR 255, 0, 0 : REM Set pen graphics color to red
150 BOX 200, 200, 400, 400 : REM Draw a box in red

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

See also: Overview of Graphics Programming in ReadyBASIC

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