Page 1 of 1

Colors in Terminal

Posted: Sun May 29, 2011 3:41 pm
by cmpitg
Hi guys,

I'm developing a console application which makes use of VT-100 compatible terminals. Usually, to produce text color, I use the escaped phrase `\\033$COLOR_CODE`. For example, to output the world "Hello world" in red, I use

Code: Select all

echo "\\033[41mHello world!"
In newLISP, I tried to do the same thing with

Code: Select all

(println "\\\\033[41mHello world!")
(println {\\033[41mHello world!})
But neither works. Does anyone know how to produce colors in terminal with newLISP?

Re: Colors in Terminal

Posted: Sun May 29, 2011 4:50 pm
by m i c h a e l
This works using Terminal on OS X:

Code: Select all

(println "\027[0;31mHello world!\027[0m")
Hope this helps.

m i c h a e l

Re: Colors in Terminal

Posted: Sun May 29, 2011 5:19 pm
by cmpitg
Thank you very much! I'm using ROXTerm in Gentoo GNU/Linux with Zsh and it works beautifully :-).

Now I understand. ASCII's 033 in octal is equivalent to 27 in decimal. (Somehow) newLISP uses decimal system to describe escape codes instead of octal.

Re: Colors in Terminal

Posted: Thu Jan 05, 2012 10:00 am
by Camryn65
Is there any way to apply colors in terminal in order files/folders to differ when i connect to a server ? As you know files/folders are the same color so it would be easer for me to recognize folders or files at a glance. I have made this change
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PS1="\[\033[1;32m\][\$(date +%H:%M)][\hu: \W$ \[\033[0m\] "
but it doesn't work with ssd connection through terminal.
thanks!!