Sophie

Sophie

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

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>Define a color pair</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ncurses-init-color.html">ncurses_init_color</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ncurses-init.html">ncurses_init</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-init-pair" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ncurses_init_pair</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_init_pair</span> &mdash; <span class="dc-title">Define a color pair</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ncurses-init-pair-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>ncurses_init_pair</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$pair</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$fg</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$bg</code></span>
   )</div>

  <p class="para rdfs-comment">
   Defines or redefines the given color pair to have the given foreground
   and background colors. If the color pair was previously initialized,
   the screen is refreshed and all occurrences of it are changed to reflect
   the new definition.
  </p>
  <p class="para">
   Color capabilities must be initialized using
    <span class="function"><a href="function.ncurses-start-color.html" class="function">ncurses_start_color()</a></span> before calling this function.
   The first color pair (color pair <em>0</em>) is assumed to
   be white on black by default, but can be changed using
    <span class="function"><a href="function.ncurses-assume-default-colors.html" class="function">ncurses_assume_default_colors()</a></span>.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ncurses-init-pair-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 number of the color pair to define.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       The foreground color for the color pair. May be one of the
       <a href="ncurses.colorconsts.html" class="link">pre-defined colors</a>
       or one defined by  <span class="function"><a href="function.ncurses-init-color.html" class="function">ncurses_init_color()</a></span> if
       the terminal has color changing capabilities.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       The background color for the color pair. May be one of the
       <a href="ncurses.colorconsts.html" class="link">pre-defined colors</a>
       or one defined by  <span class="function"><a href="function.ncurses-init-color.html" class="function">ncurses_init_color()</a></span> if
       the terminal has color changing capabilities.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ncurses-init-pair-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <em>-1</em> if the function was successful, and
   <em>0</em> if ncurses or color support were not initialized.
  </p>
 </div>

 <div class="refsect1 notes" id="refsect1-function.ncurses-init-pair-notes">
  <h3 class="title">Notes</h3>
  <p class="para">
   Note that color changing capabilities are not required for
   defining color pairs of pre-existing colors, but only for changing
   definitions (red, green, and blue components)
   of colors themselves per  <span class="function"><a href="function.ncurses-init-color.html" class="function">ncurses_init_color()</a></span>.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.ncurses-init-pair-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-631">
    <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-init-pair-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.ncurses-pair-content.html" class="function" rel="rdfs-seeAlso">ncurses_pair_content()</a> - Retrieves foreground and background colors of 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-init-color.html">ncurses_init_color</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ncurses-init.html">ncurses_init</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>