Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with Displaying Colored Text?

2 views
Skip to first unread message

Jason Plew

unread,
Dec 7, 2002, 12:15:12 AM12/7/02
to
I've rather new to lisp - am running CLISP inside a Linux Terminal.
What I was wondering is if there is any way to have the a LISP program
display colored text on the screen. Any help would be greatly
appreciated. Thanks.

Jason Plew

Tim Daly, Jr.

unread,
Dec 7, 2002, 12:39:46 AM12/7/02
to
pl...@yahoo.com (Jason Plew) writes:


I believe that you can use the ANSI escape sequences to change colors
in most Linux terminals. I'm sure that Google can tell you what the
various escape sequences are.

In lisp, character literals are prefixed with an octothorp-backslash,
so if you want to write the character 'p' in your program, you type
'#\p'. Troublesome characters usually have a mnemonic which works
too, like #\Newline and #\Escape. This gives us a way to put the ANSI
escape sequences into a program:

(defconstant ansi-red
(coerce #(#\escape #\[ #\0 #\; #\3 #\1 #\m) 'string))

In this example, I've written out a vector of characters, then turned
it into a string, and saved it as the constant ANSI-RED. Now, if you
print that constant, it should turn everything red:

(print ansi-red)

I hope that's enough to have some fun with. :)

-Tim

Marc Spitzer

unread,
Dec 7, 2002, 1:13:27 AM12/7/02
to
pl...@yahoo.com (Jason Plew) writes:

xemacs or emacs and ilisp.

marc

>
> Jason Plew

Jason Plew

unread,
Dec 8, 2002, 3:36:02 AM12/8/02
to
Worked Perfectly. Thanks for the help.

Jason Plew

t...@tenkan.org (Tim Daly, Jr.) wrote in message news:<wk3cpae...@tenkan.org>...

Kalle Olavi Niemitalo

unread,
Dec 8, 2002, 3:31:09 AM12/8/02
to
t...@tenkan.org (Tim Daly, Jr.) writes:

> I believe that you can use the ANSI escape sequences to change colors
> in most Linux terminals. I'm sure that Google can tell you what the
> various escape sequences are.

For Linux specifically: man console_codes

More generally: <http://www.ecma.ch/ecma1/STAND/ECMA-048.HTM>

0 new messages