How can i make the colorful font with black background for puts?

puts 'Hello World."

That prints 'Hello World' on white background with normal font size.
How can i make the font size bigger with black background and with green
font color like we can do in gnome-terminal from

Colors.

Is it possible to change color of font and background color of terminal
with ruby?

···

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

http://rubyworks.github.com/ansi

Hi,

When working on Linux, ANSI escape codes are probably the most simple
(but also most lowlevel) way to do this:

There are also a lot of libraries floating around. The most extensive is
probably ncurses.

···

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

I'm trying to do 'green font/texts on black background'.

printf "\033[40m\033[37mBlack Background\033[0m\n"

But that green is not brighter.
I'm trying to do something like,
http://kpumuk.info/ruby-on-rails/colorizing-console-ruby-script-output/

ESC-1, 32;40

How can i rewrite this printf "\033[40m\033[37mBlack
Background\033[0m\n" for escape one(1) ?

···

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

How can i set the text color to light green? Not the 32 only.

···

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

$ gem install term-ansicolor

In your Ruby code:

   require 'term/ansicolor'

   class String
     include Term::ANSIColor
   end

   puts "Hello World".green.on_black

More info: GitHub - flori/term-ansicolor: Ruby library that colors strings using ANSI escape sequences

···

On 04/19/2012 03:08 PM, gmspro gmspro wrote:

puts 'Hello World." That prints 'Hello World' on white background with normal font size. How can i make the font size bigger with black background and with green font color like we can do in gnome-terminal from Edit>Preferences>Colors. Is it possible to change color of font and background color of terminal with ruby?

--
Lars Haugseth

W dniu 19 kwietnia 2012 17:08 użytkownik gmspro gmspro
<lists@ruby-forum.com> napisał:

I'm trying to do 'green font/texts on black background'.

printf "\033[40m\033[37mBlack Background\033[0m\n"

But that green is not brighter.
I'm trying to do something like,
Colorizing console Ruby-script output | Dmytro Shteflyuk's Home

ESC-1, 32;40

How can i rewrite this printf "\033[40m\033[37mBlack
Background\033[0m\n" for escape one(1) ?

These technique (ANSI escape codes) only work on Linux flavors. To
make it work on Windows, you need to run your Ruby script from inside
some better console than default cmd - I suggest ansicon (google it).

-- Matma Rex

Has anyone got this to work for (all) ruby output? Like in a bashrc or
something?
It'd be nice to have rake output, and the like, be escaped automatically..

···

On Thu, Apr 19, 2012 at 11:34 AM, gmspro gmspro <lists@ruby-forum.com> wrote:

How can i set the text color to light green? Not the 32 only.

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

puts "\033[40;37;1mBlack Background\033[0m"

Notes:
- puts appends "\n" automatically
- escape sequence "\033[1m" is used for bright (high intensity)
- separate escape sequences can be combined by changing the trailing
'm' of all but the last one to ';'

···

On Thu, Apr 19, 2012 at 10:08 AM, gmspro gmspro <lists@ruby-forum.com> wrote:

I'm trying to do 'green font/texts on black background'.

printf "\033[40m\033[37mBlack Background\033[0m\n"

But that green is not brighter.
I'm trying to do something like,
Colorizing console Ruby-script output | Dmytro Shteflyuk's Home

ESC-1, 32;40

How can i rewrite this printf "\033[40m\033[37mBlack
Background\033[0m\n" for escape one(1) ?

I just read about grc today. Might try that.

···