Working with Ruby by Jan Lelis

Building yet another terminal colors gem: term-ansicolor meets rainbow

There are plenty terminal color gems out there. Now, there is one more. Why?

What’s out there?

I’ve found about 14 miscellaneous ansi color string libraries with some quick searches on github and rubygems. However, about eight of them where using string extensions. This is not really suitable for library development.

The most interesting (and popular) ones are rainbow, which supports 256-color terminals, and term-ansicolor, which can be used very flexible without forcing string extensions. HighLine is another nice gem that’s capable of terminal colors, but it’s just a little part of something that maybe can be described as a “console io framework”.

My design goals

  • Should not use string extensions by default
  • Should support 256 colors
  • Should have a consistent api that is easy to use
  • Should allow applying multiple effects via one escape sequence, not by nesting (so red and bold is \e[31;1m not \e[31m\e[1m)
  • Should provide a way to define custom color names (this also allows to get compatible with gems that use “wrong” color names, e.g. Wirb and Wirble)
  • Should support setting any escape sequences, even if the current terminal does not support it
  • Should stay as thin as possible

Paint!

See the results at github.com/janlelis/paint ;)

Creative Commons License

Comments

buy sunglasses online uk | May 05, 2015

Baby value, love ah! Too fond of, no color, feels very good, is what I always wanted pack, I did not expect so cheap to buy such a good thing, although the shipping and delivery a bit slow, but does not affect Ha, love it! Favorite quickly start it!
buy sunglasses online uk http://www.cambridgeservicealliance.org/buy-sunglasses-online-uk

reading sunglasses uk | May 06, 2015

Good style, very nice atmosphere, colleagues say good-looking, satisfied
reading sunglasses uk http://sleepwellgroup.com/reading-sunglasses-uk

buy designer sunglasses | May 07, 2015

Packaging is very good, good quality, good-looking, no color, the seller good attitude, express to the force, will continue to focus on the
buy designer sunglasses http://www.thebespokewardrobe.co.uk/buy-designer-sunglasses

ray ban glasses | May 08, 2015

The bag is very good, very beautiful, feels very comfortable, the quality is very good, the boss also good, a praise
ray ban glasses http://www.rcsolicitors.co.uk/ray-ban-glasses-cheap-uk

ray ban glasses | May 09, 2015

Package good. Is genuine. Very good very like colors and styles. Back a grade.. Express soon. Thank the seller for patient explanation. Good service attitude.
ray ban glasses http://www.aimresearch.org/ray-ban-glasses-sale-uk

ray ban glasses | May 10, 2015

Bag is very good, the best choice in the summer, sort just good! Bright colors! Purple faint liked na! When I purchased the contrast for a long time, this now online ninety absolutely not the same as buying the right
ray ban glasses http://www.aimresearch.org/ray-ban-glasses-sale-uk

ray ban glasses cheap uk | May 11, 2015

Baby received today, open on see is very surprised, very grade, unable to hold oneself back to daily necessities are placed inside, baby space is very large, can put a lot of things, carrying up a grade. The cortex is very good, feels very comfortable, very worth buying a bag. The seller who is also very good.
ray ban glasses cheap uk http://www.rcsolicitors.co.uk/ray-ban-glasses-cheap-uk

reading sunglasses uk | May 12, 2015

Baby is very good, open the package when received a very pleasant surprise, better than imagined, the seller provides a good service, really like this one ~ out
reading sunglasses uk http://sleepwellgroup.com/reading-sunglasses-uk

ray ban glasses | May 13, 2015

Bag of good quality, color, no color difference, work is also very careful, just the right size, fashionable and stylish, the chain quality is also very good, and the description of the agreement, this price can buy quality is so good bag, value, the seller is very nice, patient and meticulous, thoughtful service, delivery fast also, next time will come again, praise.
ray ban glasses http://www.rcsolicitors.co.uk/ray-ban-glasses-cheap-uk

reading sunglasses uk | May 15, 2015

The bag is very good, also took the fashion, logistics fast, received after the baby is really very good, like the seller described, quality super rods, sellers are really carefully packed tight. It was very thoughtful of the. Everyone deserves to visit. The next time I have to this shop.
reading sunglasses uk http://sleepwellgroup.com/reading-sunglasses-uk

buy sunglasses online uk | May 17, 2015

The bag is good, the fabric is soft, comfortable, I like it very much. Really value. The color is my favorite, the store is responsible, packaging is very good. Logistics is also very impressive, even gave a small card bag, packed bus card good
buy sunglasses online uk http://www.cambridgeservicealliance.org/buy-sunglasses-online-uk

ray ban glasses | May 19, 2015

The bag to receive service attitude is very high high quality and inexpensive sellers price very good delivery fast logistics awesome.
ray ban glasses http://www.rcsolicitors.co.uk/ray-ban-glasses-cheap-uk

cheap sunglasses uk | May 19, 2015

The bag is very beautiful, just like in the entity saw good workmanship is very fine leather, determined to be authentic bags,
cheap sunglasses uk http://sleepwellgroup.com/reading-sunglasses-uk

ray ban glasses | May 20, 2015

The bag is too beautiful, and photos, no color difference, color, good quality, version type bag is also very like. The husband also said super value to buy, after all in your home to buy a bag. The seller also service attitude is super good sent card bag pink also like..
ray ban glasses http://www.rcsolicitors.co.uk/ray-ban-glasses-cheap-uk

designer sunglasses | May 21, 2015

The bag is very nice, but the store sent the wrong color, red to black, but my sister liked, say very atmosphere, the seller attitude is also very good, logistics is also fast, very value.
designer sunglasses http://www.thebespokewardrobe.co.uk/buy-designer-sunglasses

mens sunglasses | May 22, 2015

Style is tidal, workmanship is very great! The price is high, the color is also very good, the overall feeling pretty good, the size is very positive, no taste, the zipper is good, fine workmanship, a shopping is very good!
mens sunglasses http://randrapparel.com/balenciaga-mens-sunglasses

ray ban sunglasses outlet | May 31, 2015

Get the you want after browsing our collection of in our store. A large number of products in stock now. Delivery and returns are always free.
<a href="http://socialcapitalmarkets.net/bhp/ray-ban-sunglasses-outlet.html" >ray ban sunglasses outlet</a> [url=http://socialcapitalmarkets.net/bhp/ray-ban-sunglasses-outlet.html]ray ban sunglasses outlet[/url]

I just love those Clubmaster sunglasses. I'm gtneitg a pair! I have seen they also come in colors for a more funkier look. See the specs here : . Thanks for featuring them! | June 30, 2015

I just love those Clubmaster sunglasses. I'm gtneitg a pair! I have seen they also come in colors for a more funkier look. See the specs here : . Thanks for featuring them!

I'm with Ken, Junior is one of my all-time favorites. We<a href="http://hlwunidf.com"> rellay</a> lost a great one when he passed. Junior used to run a Juke Joint where R.L. Burnside, another local resident, was a regular. Junior and R.L. were both on Fat Possum records & collaborated a lot, as well as the Black Keys. If you dig that hill country sound, look into R.L. and drift to another neighbor, the North Mississippi Allstars. | July 02, 2015

I'm with Ken, Junior is one of my all-time favorites. We<a href="http://hlwunidf.com"> rellay</a> lost a great one when he passed. Junior used to run a Juke Joint where R.L. Burnside, another local resident, was a regular. Junior and R.L. were both on Fat Possum records & collaborated a lot, as well as the Black Keys. If you dig that hill country sound, look into R.L. and drift to another neighbor, the North Mississippi Allstars.

If I <a href="http://skrivf.com">cocnamimuted</a> I could thank you enough for this, I'd be lying. | July 04, 2015

If I <a href="http://skrivf.com">cocnamimuted</a> I could thank you enough for this, I'd be lying.

You? | July 05, 2015