| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Selects a color from the current SetColor() string.
ColorSelect( <nColorIndex> ) --> NIL
The return value is always NIL.
The function ColorSelect() selects a color value from the current SetColor() string for standard console output. ColorSelect() does not change the SetColor() string. Constants from the COLOR.CH file can be used to address a specific color value:
#defined constants for ColorSelect()
| Constant | Value | Description |
|---|---|---|
| CLR_STANDARD | 0 | All screen output commands and functions |
| CLR_ENHANCED | 1 | GETs and selection highlights |
| CLR_BORDER | 2 | Screen border (not supported on EGA and VGA monitors) |
| CLR_BACKGROUND | 3 | Not supported |
| CLR_UNSELECTED | 4 | Unselected GETs |
If the SetColor() string contains more than five color values, other colors can be selected by passing a value > 4 to the function.
| See also: | SET COLOR, SetBlink(), SetColor() |
| Category: | Screen functions |
| Header: | color.ch |
| Source: | rtl\setcolor.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example demonstrates changing of colors for the ? command.
#include "Color.ch"
PROCEDURE Main
LOCAL cColor := SetColor( "N/W,W+/N,W+/W,W+/B,GR+/B" )
? "SetColor():", SetColor()
?
? "ColorSelect( CLR_STANDARD )"
ColorSelect( CLR_ENHANCED )
? "ColorSelect( CLR_ENHANCED )"
ColorSelect( CLR_BORDER )
? "ColorSelect( CLR_BORDER )"
ColorSelect( 3 )
? "ColorSelect( CLR_BACKGROUND )"
ColorSelect( 4 )
? "ColorSelect( CLR_UNSELECTED )"
ColorSelect( 0 )
? "Back to standard color"
RETURN
http://www.xHarbour.com