Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 2f23fa33dbe9052d0cf09567f1224d7c > files > 30

slang-doc-1.4.4-3mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE> {The S-lang C Library Reference}: SLsmg_set_color (int)</TITLE>
 <LINK HREF="cref-11.html" REL=next>
 <LINK HREF="cref-9.html" REL=previous>
 <LINK HREF="cref.html#toc10" REL=contents>
</HEAD>
<BODY>
<A HREF="cref-11.html">Next</A>
<A HREF="cref-9.html">Previous</A>
<A HREF="cref.html#toc10">Contents</A>
<HR>
<H2><A NAME="SLsmg_set_color (int)"></A> <A NAME="s10">10. <B>SLsmg_set_color (int)</B></A></H2>

<P>
<DL>
<DT><B> Synopsis </B><DD><P>Set the current color
<DT><B> Usage </B><DD><P><CODE>void SLsmg_set_color (int c);</CODE>
<DT><B> Description </B><DD><P><CODE>SLsmg_set_color</CODE> is used to set the current color.  The
parameter <CODE>c</CODE> 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
<CODE>SLtt_set_color</CODE> function.
<DT><B> Example </B><DD><P>This example defines color <CODE>7</CODE> to be green foreground on black
background and then displays some text in this color:
<BLOCKQUOTE><CODE>
<PRE>
      SLtt_set_color (7, NULL, "green", "black");
      SLsmg_set_color (7);
      SLsmg_write_string ("Hello");
      SLsmg_refresh ();
</PRE>
</CODE></BLOCKQUOTE>
<DT><B> Notes </B><DD><P>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 <CODE>SLsmg</CODE>
routines.  The lower level <CODE>SLtt</CODE> interface converts the color
descriptors to actual colors.  Thus
<BLOCKQUOTE><CODE>
<PRE>
      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 ();
</PRE>
</CODE></BLOCKQUOTE>

will result in <CODE>"hello"</CODE> displayed in red on blue and <EM>not</EM>
green on black.
<DT><B> See Also </B><DD><P><CODE>SLtt_set_color, SLtt_set_color_object</CODE>
</DL>
<P>
<P>
<P>
<HR>
<A HREF="cref-11.html">Next</A>
<A HREF="cref-9.html">Previous</A>
<A HREF="cref.html#toc10">Contents</A>
</BODY>
</HTML>