Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 5e1854624d3bc613bdd0dd13d1ef9ac7 > files > 3455

gap-system-4.4.12-5mdv2010.0.i586.rpm

<html><head><title>[xgap] 6.3 Colors in XGAP</title></head>
<body text="#000000" bgcolor="#ffffff">
[<a href = "C006S000.htm">Up</a>] [<a href ="C006S002.htm">Previous</a>] [<a href ="C006S004.htm">Next</a>] [<a href = "theindex.htm">Index</a>]
<h1>6.3 Colors in XGAP</h1><p>
<p>
labelColor Models
<p>
Depending on the type of display you are using, there may be more or
fewer colors available. You should write your programs always such that
they work even on monochrome displays. In XGAP these differences can
be read off from the so called ``color model''. The global variable
<code>COLORS</code> contains all available information.
<p>
<a name = "SSEC1"></a>
<li><code>COLORS V</code>
<p>
The variable  <code>COLORS</code> contains a list  of available colors.  If an entry
is <code>false</code> this  color is not available  on your screen.  Possible colors
are: <code>"black"</code>, <code>"white"</code>, <code>"lightGrey"</code>, <code>"dimGrey"</code>, <code>"red"</code>, <code>"blue"</code>,
and <code>"green"</code>.
<p>
The  following example opens   a new graphic sheet  (see <a href="C006S001.htm#SSEC1">GraphicSheet</a>),
puts  a black box (see  <a href="C006S002.htm#SSEC2">Box</a>) onto it and  changes its color.  Obviously
you need a color display for this example.
<p>
<pre>
gap&gt; sheet := GraphicSheet( "Nice Sheet", 300, 300 );
&lt;graphic sheet "Nice Sheet"&gt;
gap&gt; box := Box( sheet, 10, 10, 290, 290 );
&lt;box&gt;
gap&gt; Recolor( box, COLORS.green );
gap&gt; Recolor( box, COLORS.blue );
gap&gt; Recolor( box, COLORS.red );
gap&gt; Recolor( box, COLORS.lightGrey );
gap&gt; Recolor( box, COLORS.dimGrey );
gap&gt; Close(sheet);
</pre>
<p>
The component <code>model</code> is always a string. It is <code>monochrome</code>, if the 
display does not support colors. It is <code>gray</code> if we only have gray shades
and <code>colorX</code> if we have colors. The ``X'' can be either 3 or 5, depending
on how many colors are available.
<p>
<p>
[<a href = "C006S000.htm">Up</a>] [<a href ="C006S002.htm">Previous</a>] [<a href ="C006S004.htm">Next</a>] [<a href = "theindex.htm">Index</a>]
<P>
<address>xgap manual<br>Mai 2003
</address></body></html>