* Bug 16638 fixed: getcolor() rendering debugged
[scilab.git] / scilab / modules / graphics / help / en_US / color_management / color.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" xml:id="color">
17     <refnamediv>
18         <refname>color</refname>
19         <refpurpose>returns the color id of a color</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>id=color(name)
24             id=color(r,g,b)
25         </synopsis>
26     </refsynopsisdiv>
27     <refsection>
28         <title>Arguments</title>
29         <variablelist>
30             <varlistentry>
31                 <term>name</term>
32                 <listitem>
33                     <para>name of a color.</para>
34                 </listitem>
35             </varlistentry>
36             <varlistentry>
37                 <term>r,g,b</term>
38                 <listitem>
39                     <para>RGB integer values of a color.</para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>id</term>
44                 <listitem>
45                     <para>id of the color.</para>
46                 </listitem>
47             </varlistentry>
48         </variablelist>
49     </refsection>
50     <refsection>
51         <title>Description</title>
52         <para>
53             <literal>color</literal> returns the color id corresponding to its argument:
54         </para>
55         <itemizedlist>
56             <listitem>
57                 <para>
58                     <literal>name</literal> must be the name of a known color (see <link linkend="color_list">color_list</link>).
59                 </para>
60             </listitem>
61             <listitem>
62                 <para>
63                     <literal>r</literal>, <literal>g</literal> and <literal>b</literal> must be integers between 0 and 255
64                     corresponding to colors components red, green and blue. As usual 0 means no intensity and
65                     255 means all the intensity of the color.
66                 </para>
67             </listitem>
68         </itemizedlist>
69         <para> If the requested color does not exist in the current colormap it is added to the
70             colormap. If no window exists, the color is added to the default figure colormap.
71         </para>
72         <para> This function can be used to specify the foreground or background colors when plotting.
73         </para>
74     </refsection>
75     <refsection>
76         <title>Examples</title>
77         <programlisting role="example"><![CDATA[
78 x=linspace(-2*%pi,2*%pi,100)';
79 // using existing colors
80 plot2d(x,[sin(x),cos(x)],style=[color("red"),color("green")]);
81 // new colors: there are added to the colormap
82 e=gce(); p1=e.children(1); p2=e.children(2);
83 p1.foreground=color("purple"); p2.foreground=color("navy blue");
84 // using RGV values
85 p1.foreground=color(255,128,128);
86  ]]></programlisting>
87         <scilab:image>
88             x=linspace(-2*%pi,2*%pi,100)';
89             // using existing colors
90             plot2d(x,[sin(x),cos(x)],style=[color("red"),color("green")]);
91             // new colors: there are added to the colormap
92             e=gce(); p1=e.children(1); p2=e.children(2);
93             p1.foreground=color("purple"); p2.foreground=color("navy blue");
94             // using RGV values
95             p1.foreground=color(255,128,128);
96         </scilab:image>
97     </refsection>
98     <refsection role="see also">
99         <title>See also</title>
100         <simplelist type="inline">
101             <member>
102                 <link linkend="colormap">colormap</link>
103             </member>
104             <member>
105                 <link linkend="color_list">color_list</link>
106             </member>
107             <member>
108                 <link linkend="getcolor">getcolor</link>
109             </member>
110         </simplelist>
111     </refsection>
112 </refentry>