Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 4516

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Set active foreground and background colors</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ncurses-color-content.html">ncurses_color_content</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ncurses-curs-set.html">ncurses_curs_set</a></div>
 <div class="up"><a href="ref.ncurses.html">Ncurses Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ncurses-color-set" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ncurses_color_set</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.7, PHP 5 &lt; 5.3.0, PECL ncurses &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">ncurses_color_set</span> &mdash; <span class="dc-title">Set active foreground and background colors</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ncurses-color-set-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>ncurses_color_set</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$pair</code></span>
   )</div>

  <p class="para rdfs-comment">
   Sets the active foreground and background colors. Any characters written
   after this function is invoked will have these colors. This function requires
   terminal colors to be supported and initialized using
    <span class="function"><a href="function.ncurses-start-color.html" class="function">ncurses_start_color()</a></span> beforehand.
  </p>
  <p class="para">
   ncurses uses color pairs to specify both foreground and background colors.
   Use  <span class="function"><a href="function.ncurses-init-pair.html" class="function">ncurses_init_pair()</a></span> to define a color pair.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ncurses-color-set-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">pair</code></em></span>
     <dd>

      <p class="para">
       The color pair from which to get the foreground and background colors
       to set as the active colors.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ncurses-color-set-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <em>-1</em> on success, and <em>0</em> on failure.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.ncurses-color-set-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-628">
    <p><strong>Example #1 Writing a string with a specified color to the screen</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />ncurses_init</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;the&nbsp;terminal&nbsp;supports&nbsp;colors,&nbsp;initialize&nbsp;and&nbsp;set&nbsp;active&nbsp;color<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">ncurses_has_colors</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ncurses_start_color</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ncurses_init_pair</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NCURSES_COLOR_YELLOW</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NCURSES_COLOR_BLUE</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ncurses_color_set</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;Write&nbsp;a&nbsp;string&nbsp;at&nbsp;specified&nbsp;location<br /></span><span style="color: #0000BB">ncurses_mvaddstr</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Hello&nbsp;world!&nbsp;Yellow&nbsp;on&nbsp;blue&nbsp;text!"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Flush&nbsp;output&nbsp;to&nbsp;screen<br /></span><span style="color: #0000BB">ncurses_refresh</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">ncurses_end</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.ncurses-color-set-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.ncurses-init-pair.html" class="function" rel="rdfs-seeAlso">ncurses_init_pair()</a> - Define a color pair</span></li>
    <li class="member"> <span class="function"><a href="function.ncurses-start-color.html" class="function" rel="rdfs-seeAlso">ncurses_start_color()</a> - Initializes color functionality</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ncurses-color-content.html">ncurses_color_content</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ncurses-curs-set.html">ncurses_curs_set</a></div>
 <div class="up"><a href="ref.ncurses.html">Ncurses Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>