1############################################################################# 2## 3#W color.gd XGAP library Frank Celler 4## 5## 6#Y Copyright 1995-1997, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany 7#Y Copyright 1997, Frank Celler, Huerth, Germany 8#Y Copyright 1998, Max Neunhoeffer, Aachen, Germany 9## 10 11############################################################################# 12#1 13## Depending on the type of display you are using, there may be more or 14## fewer colors available. You should write your programs always such that 15## they work even on monochrome displays. In {\XGAP} these differences can 16## be read off from the so called ``color model''. The global variable 17## `COLORS' contains all available information. 18 19 20############################################################################# 21## 22#C IsColor . . . . . . . . . . . . . . . . . . . . . . . category of colors 23## 24DeclareCategory( "IsColor", IsObject ); 25DeclareSynonym( "IsColour", IsColor ); 26 27 28############################################################################# 29## 30#O ColorId( <color> ) . . . . . . . . . . . . . . . . . color id of a color 31## 32DeclareOperation( "ColorId", [ IsColor ] ); 33DeclareSynonym( "ColourId", ColorId ); 34 35############################################################################# 36## 37#O PSColour( <color> ) . . . . . . . . . . . PostScript string for a color 38## 39DeclareOperation( "PSColour", [ IsColor ] ); 40DeclareSynonym( "PSColor", PSColour ); 41 42############################################################################# 43## 44#O FigColour( <color> ) . . . . . . . . . . . Fig string for a color 45## 46DeclareOperation( "FigColour", [ IsColor ] ); 47DeclareSynonym( "FigColor", FigColour ); 48 49############################################################################# 50## 51#V ColorFamily . . . . . . . . . . . . . . . . . . . . . . family of colors 52## 53BindGlobal( "ColorFamily", NewFamily( "ColorFamily" ) ); 54DeclareSynonym( "ColourFamily", ColorFamily ); 55 56 57############################################################################# 58## 59#V COLORS . . . . . . . . . . . . . . . . . . . . list of available colors 60## 61## The variable `COLORS' contains a list of available colors. If an entry 62## is `false' this color is not available on your screen. Possible colors 63## are: `"black"', `"white"', `"lightGrey"', `"dimGrey"', `"red"', `"blue"', 64## and `"green"'. 65## 66## The following example opens a new graphic sheet (see "GraphicSheet"), 67## puts a black box (see "Box") onto it and changes its color. Obviously 68## you need a color display for this example. 69## 70## \begintt 71## gap> sheet := GraphicSheet( "Nice Sheet", 300, 300 ); 72## <graphic sheet "Nice Sheet"> 73## gap> box := Box( sheet, 10, 10, 290, 290 ); 74## <box> 75## gap> Recolor( box, COLORS.green ); 76## gap> Recolor( box, COLORS.blue ); 77## gap> Recolor( box, COLORS.red ); 78## gap> Recolor( box, COLORS.lightGrey ); 79## gap> Recolor( box, COLORS.dimGrey ); 80## gap> Close(sheet); 81## \endtt 82## 83## The component `model' is always a string. It is `monochrome', if the 84## display does not support colors. It is `gray' if we only have gray shades 85## and `colorX' if we have colors. The ``X'' can be either 3 or 5, depending 86## on how many colors are available. 87## 88DeclareGlobalFunction( "CreateColors" ); 89DeclareGlobalVariable( "COLORS" ); 90DeclareSynonym( "COLOURS", COLORS ); 91 92 93############################################################################# 94## 95 96#E color.gd . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here 97 98