<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> sheet := GraphicSheet( "Nice Sheet", 300, 300 ); <graphic sheet "Nice Sheet"> gap> box := Box( sheet, 10, 10, 290, 290 ); <box> gap> Recolor( box, COLORS.green ); gap> Recolor( box, COLORS.blue ); gap> Recolor( box, COLORS.red ); gap> Recolor( box, COLORS.lightGrey ); gap> Recolor( box, COLORS.dimGrey ); gap> 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>