COLOR statement

Purpose

Set the foreground and background colors when displaying text in the active console page.

Syntax

COLOR [foreground], [background] [, count]

Remarks

foreground is an integer-class expression from 0 to 15, specifying the character color.  background is an integer-class expression from 0 to 15, specifying the background color.

If either expression is out of range or missing, that value is left unchanged.  Count is optional, and if included, causes the color attribute to be applied immediately to that number of character cells, starting at the current caret location.  The caret is not moved, and the underlying characters are not changed.

Color attribute code table

value

Color

0

Black

1

Blue

2

Green

3

Cyan

4

Red

5

Magenta

6

Brown

7

White

8

Gray

9

Light blue

10

Light green

11

Light cyan

12

Light red

13

Light magenta

14

Yellow

15

High intensity white

Restrictions

The console window does not support flashing text.

See also

CLS, PAGE, PAGEACTIVE, PAGEVISIBLE, PCOPY, PRINT, SCREENATTR

Example

COLOR ,4 ' set background color to red