QBColor Function

Purpose

Sets the foreground and background color of a Form.

Syntax

QBColor fore, back

rgb = QBColor(index)

fore, back, index, rgb:iexp

Description

QBColor sets a color from the standard 16 VGA colors. The arguments fore and back must specify a value from 0 to 15.

The function QBColor(index) returns the RGB-value for the specified VGA color with index.

The arguments fore, back and index can be one of:

0 - black

1 - dark red

2 - dark green

3 - yellow-green

4 - dark blue

5 - blue-red

6 - green-grey

7 - bright grey

8 - dark grey

9 - bright red

10 - bright green

11 - bright yellow

12 - bright blue

13 - magenta

14 - turquoise

15 - white

Example

// draw all 16 colors in a color table

OpenW 1

Local i%, a%, b%

a% = _X / 8

For i% = 0 To 7

QBColor i%

PBox i% * a%, 0, (i% + 1) * a%, _Y / 2

Next i%

For i% = 8 To 15

QBColor i%

PBox (i% - 8) * a%, _Y / 2, i% * a%, _Y

Next i%

Do

Sleep

Until Me Is Nothing

Remarks

In contrast to earlier GFABASIC versions, the Color command takes rgb color values rather than an index in the VGA color table. Instead of using the old Color index statement, you can now use QBColor in either of two ways.

Color QBColor(7)

QBColor 7

See Also

Color, RGBColor, SysCol

{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}