Next Previous Contents

10. void SLsmg_set_color (int);

Synopsis

Set the current color

Usage

void SLsmg_set_color (int c);

Description

SLsmg_set_color is used to set the current color. The parameter c is really a color object descriptor. Actual foreground and background colors as well as other visual attributes may be associated with a color descriptor via the SLtt_set_color function.

Example

This example defines color 7 to be green foreground on black background and then displays some text in this color:

      SLtt_set_color (7, NULL, "green", "black");
      SLsmg_set_color (7);
      SLsmg_write_string ("Hello");
      SLsmg_refresh ();
Notes

It is important to understand that the screen managment routines know nothing about the actual colors associated with a color descriptor. Only the descriptor itself is used by the SLsmg routines. The lower level SLtt interface converts the color descriptors to actual colors. Thus

      SLtt_set_color (7, NULL, "green", "black");
      SLsmg_set_color (7);
      SLsmg_write_string ("Hello");
      SLtt_set_color (7, NULL, "red", "blue");
      SLsmg_write_string ("World");
      SLsmg_refresh ();
will result in "hello" displayed in red on blue and not green on black.
See Also

SLtt_set_color, SLtt_set_color_object


Next Previous Contents