[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ANSI Terminal Colors Module
- From: "Juris Kalnins" <juris@...>
- Date: Tue, 29 Dec 2009 09:15:05 +0200
On Mon, 28 Dec 2009 22:46:05 +0200, Rob Hoelz <rob@hoelzro.net> wrote:
I figured I'd just start simple, but feel free to optimize! =)
Well, since you say so... :)
simple:
bright = '\27[1m'
red = '\27[31m'
...
reset = '\27[m'
----
print(red, "text", reset)
more simple:
print "\27[1;31mBAD HAPPEN!\27[m"
Actually, most of the time writing escapes inline is much easier than
using a library. And since Lua accepts control characters inside quotes,
you actually can type ^[ character instead of \27 (when writing with e.g.
vim or emacs) and then using "less -R" you can see your code in full color.