This function sets or returns the foreground color of the characters.

Syntax

long SetTextColor(
  long rgb
);

Parameters

rgb
[in] Specifies the character color to set.
ValueDescription
0xRRGGBB Optional specification (RR: red, GG: green, BB: blue)
RGB_WHITE White (0xFFFFFF)
RGB_RED Red (0xFF0000)
RGB_GREEN Green (0x00FF00)
RGB_BLUE Blue (0x0000FF)
RGB_MAGENTA Magenta (0xFF00FF)
RGB_CYAN Cyan (0x00FFFF)
RGB_YELLOW Yellow (0xFFFF00)
RGB_BLACK Black (0x000000)
CURRENT_MODE Returns the current settings without changing the settings.

Return value

Returns the text color before the change.

Remarks

This setting does not affect the contents of the displayed screen.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main(void)
{
    long	txColor, bkColor;
    printf("[SetTextColor]\n");
    printf("Please any key\r");
    ResetKey();
    while(!kbhit())
        Idle();
    txColor	=	SetTextColor(0xFF0000);
    bkColor	=	SetBackColor(RGB_WHITE);
    printf("Background:white\nLetters:red\n");
    SetTextColor(txColor);
    SetBackColor(bkColor);
    printf("Please any key\r");
    ResetKey();
    while(!kbhit())
        Idle();
}

Last updated: 2022/03/09