1 ;;;; colorterm.lisp -- A rudimentary implementation of colored input/output
4 ;;;; Copyright (C) 2008 James F. Amundson
6 ;;;; colorterm.lisp is free software; you can redistribute it
7 ;;;; and/or modify it under the terms of the GNU General Public
8 ;;;; License as published by the Free Software Foundation; either
9 ;;;; version 2, or (at your option) any later version.
11 ;;;; colorterm.lisp is distributed in the hope that it will be
12 ;;;; useful, but WITHOUT ANY WARRANTY; without even the implied
13 ;;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 ;;;; See the GNU General Public License for more details.
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with colorterm.lisp; see the file COPYING. If not,
18 ;;;; write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 ;;;; To use this file in interactive mode, do
22 ;;;; load("colorterm.lisp");colorterm();
23 ;;;; To use this file every time you launch maxima, add the above line
24 ;;;; to maxima-init.mac in $HOME/.maxima
26 ;;;; Known bug: colorterm interacts poorly with rlwrap. When rlwrap is
27 ;;;; being used to run maxima (e.g., with rmaxima) extra characters appear
28 ;;;; after the prompt. These characters are confusing, but do not appear as
29 ;;;; part of the actual input.
31 ;;; Default colors. For color mappings, see comments below.
32 (defvar *prompt-color
* 31)
33 (defvar *input-color
* 34)
34 (defvar *output-color
* 30)
35 ;;; Foreground Colours
46 (let ((escape-char (code-char 27)))
48 (format nil
"~a[00;~am" escape-char
*prompt-color
*))
50 (format nil
"~a[00;~am" escape-char
*input-color
*))
51 (setf *general-display-prefix
*
52 (format nil
"~a[00;~am" escape-char
*output-color
*))
54 (format nil
"~a[00m" escape-char
))))