Colores en la terminal

Hi everyone!

I'm doing a terminal program and need to know if you can put text color.

thanks

···

--
Posted via http://www.ruby-forum.com/.

I'm doing a terminal program and need to know if you can put text color.

Yes.

Google for "ruby ansi color"

···

--
Posted via http://www.ruby-forum.com/\.

You can, but I haven't found any way to do it reliably across both Windows
and Unix.

If you are in Unix, go to the terminal and run:
$ ruby -e 'puts "\e[01mBLACK \e[32mRED \e[33mYELLOW \e[34mBLUE \e[35mMAGENTA
\e[36mCYAN \e[37mWHITE \e[0mNONE"'

The dollar sign indicates my promt. The \e is the escape key (top left on
your keyboard, ansi character 27), then a left bracket. This \e[ is called
an escape sequence, and you can put codes after it that have special
meanings. 3#m means change the foreground, 4#m means change the background
(ie run the same code above but change the 3s to 4s.

For more about escape sequences, check out

There are also a ton of gems that do this (you might make one yourself, it's
a fun short exercise, and will help you become familiar with how escape
sequences work).

···

On Thu, Aug 4, 2011 at 7:20 AM, Yábir G. <cometa199@gmail.com> wrote:

Hi everyone!

I'm doing a terminal program and need to know if you can put text color.

thanks

--
Posted via http://www.ruby-forum.com/\.

+1 for ANSICON on Windows.

more infos here :

···

--
Posted via http://www.ruby-forum.com/.

Brian Candler wrote in post #1014933:

I'm doing a terminal program and need to know if you can put text color.

Yes.

Google for "ruby ansi color"

Thank you very much, helped me a lot

···

--
Posted via http://www.ruby-forum.com/\.

I'm doing a terminal program and need to know if you can put text color.

Yes.

Google for "ruby ansi color"

Thank you very much, helped me a lot

and if you're concerned about windows, it's worth your while to look at

···

--
Posted via http://www.ruby-forum.com/\.