Colors in Terminal

Started by cmpitg, May 29, 2011, 08:41:05 AM

Previous topic - Next topic

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



echo "\033[41mHello world!"


In newLISP, I tried to do the same thing with



(println "\\033[41mHello world!")
(println {\033[41mHello world!})


But neither works. Does anyone know how to produce colors in terminal with newLISP?
\"Life is a hack\"

My web log: http://cmpitg.wordpress.com\">//http://cmpitg.wordpress.com

m i c h a e l

#1
This works using Terminal on OS X:


(println "27[0;31mHello world!27[0m")


Hope this helps.



m i c h a e l

cmpitg

#2
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.
\"Life is a hack\"

My web log: http://cmpitg.wordpress.com\">//http://cmpitg.wordpress.com

Camryn65

#3
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="[33[1;32m][$(date +%H:%M)][hu: W$ [33[0m] "

but it doesn't work with ssd connection through terminal.

thanks!!
http://www.parentingclan.com/10-classics-read-teen.html\">Teen books

http://www.beautyramp.com/lalique-perfume-top-7-fragrances.html\">Lalique Perfume