[GAP Forum] colors

Frank Luebeck frank.luebeck at math.rwth-aachen.de
Fri May 14 10:59:26 BST 2004


> I'm really embarrased to be asking
> for something so silly, but
> in the previous release of GAP,
> there was file called something
> like tips.unix that had a bunch
> of commands to cause GAP to print various
> colors.


Dear Marcus, dear Forum,

Interesting to hear that some people actually like and use the
colors which distinguish prompt, input and output in a terminal
running GAP. (I also use and like them.)

Nothing has changed about it in GAP 4.4. I've only moved the
corresponding part of the README.unix file you have mentioned to
a private page. Fetch the file

   http://www.math.rwth-aachen.de:8001/RsyncLinuxGAP/colorprompt.g

and copy it, say, to the 'lib' directory of your GAP installation.
Saying

  ReadLib("colorprompt.g");

in GAP or your ~/.gaprc file enables the colored prompt and sets
the variable 'ANSI_COLORS' to 'true'.
(You can switch it off with 'ColorPrompt(false); ANSI_COLORS := false;'.)

If ANSI_COLORS is 'true', some help pages are also displayed with
color markup.

The reason that I removed it from the "official" GAP pages is that I
mainly got negative comments so far.  But following your forum mail
I suddenly got a bunch of positive ones. So, I will put some version
of 'colorprompt.g' in the GAP library and document the functionality.
(For the moment, please follow the instructions above.)




Two more remarks on using colors with GAP (code):

(1) If you want to use colors for your own 'Print' or 'View' functions in GAP
you find  some utilities in the GAPDoc package, ask the GAP help system for

  ?TextAttr

Using this you can easily change background and foreground colors as well
as other attributes while printing to the terminal. (Of course, only
in terminal emulations which understand the "ANSI color escape
sequences", there is no way to force certain colors, they depend on the
configuration of the terminal.)

If you use this in code you may want to distribute, I suggest that you
always include a non-color variant and recognize the setting of
'ANSI_COLORS':

if ANSI_COLORS = true then
   ... with colors
else
   ... non-colored variant
fi;

(2) The GAP distribution contains some utilities for editing and viewing
GAP code with the editor 'vim', see the file 'etc/README.vim-utils'.
This includes colored syntax hilighting, automatic indentation and
folding.


> It also had instructions
> on saved workspaces and tab
> completion, but these features
> have apparently been put into
> CreateWorkspace.sh.

You are right, this part of the README.unix has become a more official
part of the installation instructions. We are currently thinking about a few
more technical details concerning workspaces, such that we can change
the instructions for starting GAP with a saved workspace from "optional"
to "recommended".

With best regards,

    Frank


///  Dr. Frank Lübeck, Lehrstuhl D für Mathematik, Templergraben 64,  ///
\\\                    52062 Aachen, Germany                          \\\
///  E-mail: Frank.Luebeck at Math.RWTH-Aachen.De                        ///
\\\  WWW:    http://www.math.rwth-aachen.de/~Frank.Luebeck/           \\\









More information about the Forum mailing list