# SETTEXTCOLORRGB (W*S)

Graphics Function: Sets the current text color to the specified Red-Green-Blue (RGB) value.

## Module

USE IFQWIN

result = SETTEXTCOLORRGB (color)

color | (Input) INTEGER(4). RGB color value to set the text color to. Range and result depend on the system's display adapter.

## Results

The result type is INTEGER(4). The result is the previous text RGB color value.

In each RGB color value, each of the three colors, red, green, and blue, is represented by an eight-bit value (2 hex digits). In the value you specify with SETTEXTCOLORRGB, red is the rightmost byte, followed by green and blue. The RGB value's internal structure is as follows:

Larger numbers correspond to stronger color intensity with binary 1111111 (hex Z'FF') the maximum for each of the three components. For example, Z'0000FF' yields full-intensity red, Z'00FF00' full-intensity green, Z'FF0000' full-intensity blue, and Z'FFFFFF' full-intensity for all three, resulting in bright white.

SETTEXTCOLORRGB sets the current text RGB color. The default value is Z'00FFFFFF', which is full-intensity white. SETTEXTCOLORRGB sets the color used by OUTTEXT, WRITE, and PRINT. It does not affect the color of text output with the OUTGTEXT font routine. Use SETCOLORRGB to change the color of font output.

SETBKCOLORRGB sets the RGB color value of the current background for both text and graphics. SETCOLORRGB sets the RGB color value of graphics over the background color, used by the graphics functions such as ARC, FLOODFILLRGB, and OUTGTEXT.

SETTEXTCOLORRGB (and the other RGB color selection functions SETBKCOLORRGB and SETCOLORRGB) sets the color to a value chosen from the entire available range. The non-RGB color functions (SETTEXTCOLOR, SETBKCOLOR, and SETCOLOR) use color indexes rather than true color values.

If you use color indexes, you are restricted to the colors available in the palette, at most 256. Some display adapters (SVGA and true color) are capable of creating 262,144 (256K) colors or more. To access any available color, you need to specify an explicit RGB value with an RGB color function, rather than a palette index with a non-RGB color function.

## Example

     ! Build as a Graphics ap.
     USE IFQWIN
     INTEGER(4) oldtc

     oldtc = SETTEXTCOLORRGB(Z'000000FF')
     WRITE(*,*) 'I am red'
     oldtc = SETTEXTCOLORRGB(Z'0000FF00')
     CALL OUTTEXT ('I am green'//CHAR(13)//CHAR(10))
     oldtc = SETTEXTCOLORRGB(Z'00FF0000')
     PRINT *, 'I am blue'
     END

Parent topic: Graphics Library Routines

## See Also

SETBKCOLORRGB
SETCOLORRGB
GETTEXTCOLORRGB
GETWINDOWCONFIG
OUTTEXT