RSL_set_color_table: Given a color table index icolor, one of RSL_RED_TABLE, RSL_GREEN_TABLE or RSL_BLUE_TABLE, and a character buffer, at most 256 color indexes long, and the number of indexes in the character buffer, set the color table. Each color index in buffer contains the color intensity for that color. Range of color intensities is 0 to 255.
You must make three calls to both the get and set functions to change the entire color table entry for a particular index. For example, to change the 5th index of the color table to cyan (Red=0, Green=255, Blue=255), perform the following (provided a color table is already loaded):
char r[256], g[256], b[256];
RSL_get_color_table(RSL_RED_TABLE, r, &ncolors);
RSL_get_color_table(RSL_GREEN_TABLE, g, &ncolors);
RSL_get_color_table(RSL_BLUE_TABLE, b, &ncolors);
r[4] = (char)0; /* [4] is the 5-th index */
g[4] = (char)255;
b[4] = (char)255;
RSL_set_color_table(RSL_RED_TABLE, r, ncolors);
RSL_set_color_table(RSL_GREEN_TABLE, g, ncolors);
RSL_set_color_table(RSL_BLUE_TABLE, b, ncolors);
Author: John H. Merritt