Hello,

I actually wanted/looked for colored output in the CLI for quite a while 
myself, and finally found the solution! The magic?: "echo -e". The syntax is a 
little odd to use it, and I don't think I can explain it very succinctly. It 
may be best to see an example of it in action. I wrote a bash script to 
summarize files, and I used the "echo -e" syntax to color the output. 

Actual code: 
http://launchpod.homelinux.com:81/trac/code/browser/userextensions/summarizer.sh

Details here, with screenshots: 
http://assistedsilicon.blogspot.com/2007/04/summary-execution.html

Good luck!
-Sam

_____________________________________
----- Original Message ----
From: Tiago Saboga <[EMAIL PROTECTED]>
To: tutor@python.org
Sent: Saturday, September 29, 2007 6:11:35 PM
Subject: Re: [Tutor] linux terminal coloring in python

On Sat, Sep 29, 2007 at 08:32:37AM -0700, Robert Jackson wrote:

> I'm trying to get some pretty colored output for a Linux console /
terminal window.  Google searches only reveal the curses module to
colorize output.

> Is there a simpler way?  Curses seems to be FAR too powerful for
what it is I want to do (simply to colorize a few 'print' outputs to
the console).

I have looked for that last week and the best I could find was
ColorANSI module, distributed with ipython (in a debian system, it's
/usr/share/python-support/ipython/IPython/ColorANSI.py).

I just bookmarked it, and don't know how to make it work. But it seems
quite simple.

Tiago.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to