mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297028 c90b9560-bf6c-de11-be94-00142212c4b1
143 lines
4.2 KiB
XML
143 lines
4.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.ncurses-init-pair" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>ncurses_init_pair</refname>
|
|
<refpurpose>Define a color pair</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>ncurses_init_pair</methodname>
|
|
<methodparam><type>int</type><parameter>pair</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>fg</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>bg</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
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.
|
|
</para>
|
|
<para>
|
|
Color capabilities must be initialized using
|
|
<function>ncurses_start_color</function> before calling this function.
|
|
The first color pair (color pair <literal>0</literal>) is assumed to
|
|
be white on black by default, but can be changed using
|
|
<function>ncurses_assume_default_colors</function>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>pair</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The number of the color pair to define.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>fg</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The foreground color for the color pair. May be one of the
|
|
<link linkend="ncurses.colorconsts">pre-defined colors</link>
|
|
or one defined by <function>ncurses_init_color</function> if
|
|
the terminal has color changing capabilities.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>bg</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The background color for the color pair. May be one of the
|
|
<link linkend="ncurses.colorconsts">pre-defined colors</link>
|
|
or one defined by <function>ncurses_init_color</function> if
|
|
the terminal has color changing capabilities.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns <literal>-1</literal> if the function was successful, and
|
|
<literal>0</literal> if ncurses or color support were not initialized.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<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 <function>ncurses_init_color</function>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Writing a string with a specified color to the screen</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
ncurses_init();
|
|
|
|
// If the terminal supports colors, initialize and set active color
|
|
if (ncurses_has_colors()) {
|
|
ncurses_start_color();
|
|
ncurses_init_pair(1, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE);
|
|
ncurses_color_set(1);
|
|
}
|
|
|
|
// Write a string at specified location
|
|
ncurses_mvaddstr(10, 10, "Hello world! Yellow on blue text!");
|
|
|
|
// Flush output to screen
|
|
ncurses_refresh();
|
|
|
|
ncurses_end();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>ncurses_pair_content</function></member>
|
|
<member><function>ncurses_start_color</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|