Functions

SetColor

Return the current colors and optionally set new colors

Syntax

Signature
const char *SetColor( const char *color );

Arguments

color Color specification such as W+/B or comma-separated palette entries. NULL queries the current colors.

Return value

A pointer to the previous color string in a shared buffer.

Description

Set the palette for subsequent text output. Each comma-separated entry is a foreground/background pair, such as `W+/B`. A nonempty specification can update individual entries. Use `ColorSelect()` to select an alternate slot after setting the palette.

A `NULL` argument reads the existing palette. An empty string loads the standard color pairs. The return value is the previous palette in a shared buffer. Copy it before another call if you need to restore it later.

Example

setcolor.c
#include "xdev-wtui.h"

int main( void )
{
   SetColor( "W+/B" );
   DispOut( "Uses the current color", NULL );

   Inkey( 0, NIL );

   return 0;
}