# How would I go about doing this in ruby

**URL:** <https://www.ruby-forum.com/t/how-would-i-go-about-doing-this-in-ruby/70802>\
**Category:** Ruby\
**Created:** [October 3, 2006, 3:35am UTC](https://www.ruby-forum.com/t/how-would-i-go-about-doing-this-in-ruby/70802 "2006-10-03T03:35:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pinkman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@pinkman](https://www.ruby-forum.com/u/pinkman)\
**Post date:** [October 3, 2006, 3:35am UTC](https://www.ruby-forum.com/t/how-would-i-go-about-doing-this-in-ruby/70802/1 "2006-10-03T03:35:18Z")

</div>

Quick question, I have asked some other programmers, they were not  
sure… my friend who knows c had said cout.SetColor(‘color’); although,  
ruby is not c, but I take its something simular… so if anyone, can help  
me, this is an example, of what I want to be able to do.

[http://img217.imageshack.us/img217/5291/adsfwz0.jpg](http://img217.imageshack.us/img217/5291/adsfwz0.jpg)

thats a link to the image, and basically I wanna control the fonts  
color, and the bg color of it…

---

<div class="post-metadata">

**Author:** ![pinkman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@pinkman](https://www.ruby-forum.com/u/pinkman)\
**Post date:** [October 3, 2006, 6:14am UTC](https://www.ruby-forum.com/t/how-would-i-go-about-doing-this-in-ruby/70802/2 "2006-10-03T06:14:36Z")

</div>

Kyle Pinkman wrote:

> Quick question, I have asked some other programmers, they were not  
> sure… my friend who knows c had said cout.SetColor(‘color’); although,  
> ruby is not c, but I take its something simular… so if anyone, can help  
> me, this is an example, of what I want to be able to do.
> 
> [http://img217.imageshack.us/img217/5291/adsfwz0.jpg](http://img217.imageshack.us/img217/5291/adsfwz0.jpg)
> 
> thats a link to the image, and basically I wanna control the fonts  
> color, and the bg color of it…

This just involves outputting the color codes for the console. You can  
do this by hand, or use one of the libraries available:

[http://rubyforge.org/projects/term-ansicolor/](http://rubyforge.org/projects/term-ansicolor/)  
[http://rubyforge.org/projects/highline/](http://rubyforge.org/projects/highline/)

Hope that helps.

-Justin

---

<div class="post-metadata">

**Author:** ![pinkman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@pinkman](https://www.ruby-forum.com/u/pinkman)\
**Post date:** [October 3, 2006, 12:45pm UTC](https://www.ruby-forum.com/t/how-would-i-go-about-doing-this-in-ruby/70802/3 "2006-10-03T12:45:11Z")

</div>

Kyle Pinkman wrote:

> Quick question, I have asked some other programmers, they were not  
> sure… my friend who knows c had said cout.SetColor(‘color’); although,  
> ruby is not c, but I take its something simular… so if anyone, can help  
> me, this is an example, of what I want to be able to do.
> 
> [http://img217.imageshack.us/img217/5291/adsfwz0.jpg](http://img217.imageshack.us/img217/5291/adsfwz0.jpg)
> 
> thats a link to the image, and basically I wanna control the fonts  
> color, and the bg color of it…

If you need to implement this for Windows, as that screenshot suggests,  
you might get a quick return from win32console -

Z:\>gem list -r win32console

\*\*\* REMOTE GEMS \*\*\*

win32console (1.0.8)  
A library giving the Win32 console ANSI escape sequence support.

deejay
