Hi everyone!
I’m doing a terminal program and need to know if you can put text color.
thanks
Hi everyone!
I’m doing a terminal program and need to know if you can put text color.
thanks
I’m doing a terminal program and need to know if you can put text color.
Yes.
Google for “ruby ansi color”
Brian C. 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
On Thu, Aug 4, 2011 at 7:20 AM, Ybir G. [email protected] 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/.
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).
+1 for ANSICON on Windows.
more infos here :
http://blog.mmediasys.com/2010/11/24/we-all-love-colors/#more-390
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs