Packages raddenest and mathml: fix up Texinfo and build machinery so that documentati...
[maxima.git] / share / contrib / colorterm.lisp
blob08644c278229fc2baecb3d41f05c078e2bade846
1 ;;;; colorterm.lisp -- A rudimentary implementation of colored input/output
2 ;;;; in terminal mode.
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
20 ;;;; Notes:
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
36 ;;; 30 Black
37 ;;; 31 Red
38 ;;; 32 Green
39 ;;; 33 Yellow
40 ;;; 34 Blue
41 ;;; 35 Magenta
42 ;;; 36 Cyan
43 ;;; 37 White
45 (defun $colorterm ()
46 (let ((escape-char (code-char 27)))
47 (setf *prompt-prefix*
48 (format nil "~a[00;~am" escape-char *prompt-color*))
49 (setf *prompt-suffix*
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*))
53 (setf *maxima-epilog*
54 (format nil "~a[00m" escape-char))))