Set of ANSI Code based classes and modules for Ruby
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo Update README. :doc: Feb 26, 2015
etc :admin: Move config for QED to etc directory. Jan 9, 2015
lib 🐛 Fix rgb method. Jan 9, 2015
test :test: Modernize lemon tests. Jan 9, 2015
work :admin: Use Ergofile. Jan 16, 2015
.gitignore Update README. :doc: Feb 26, 2015
.index
.travis.yml No longer support Ruby below 1.9. Jan 6, 2015
.yardopts Adjust yardopts. [admin] Nov 5, 2011
Assembly Use markdown instead of rdoc format. [admin] Dec 8, 2012
DEMO.md
Ergofile :admin: Update Ergofile. Jan 16, 2015
Gemfile
HISTORY.md
INDEX.yml
LICENSE.txt
MANIFEST
NOTICE.md
README.md Update README. :doc: Feb 26, 2015
Rakefile :admin: Ergo crap and update history file. Jan 16, 2015
ansi.gemspec :admin: Update index and gemspec. Jan 6, 2015

README.md

ANSI

HOME · API · ISSUES · SOURCE

Build Status


The ANSI project is a collection of ANSI escape code related libraries enabling ANSI code based colorization and stylization of output. It is very nice for beautifying shell output.

This collection is based on a set of scripts spun-off from Ruby Facets. Included are Code (used to be ANSICode), Logger, ProgressBar and String. In addition the library includes Terminal which provides information about the current output device.

Features

  • ANSI::Code provides ANSI codes as module functions.
  • String#ansi makes common usage very easy and elegant.
  • ANSI::Mixin provides an alternative mixin (like +colored+ gem).
  • Very Good coverage of standard ANSI codes.
  • Additional clases for colorized columns, tables, loggers and more.

Synopsis

There are a number of modules and classes provided by the ANSI package. To get a good understanding of them it is best to pursue the QED documents or the API documentation.

At the heart of all the provided libraries lies the ANSI::Code module which defines ANSI codes as constants and methods. For example:

require 'ansi/code'

ANSI.red + "Hello" + ANSI.blue + "World"
=> "\e[31mHello\e[34mWorld"

Or in block form.

ANSI.red{ "Hello" } + ANSI.blue{ "World" }
=> "\e[31mHello\e[0m\e[34mWorld\e[0m"

The methods defined by this module are used throughout the rest of the system.

Installation

Bundler

Add the usual gem line to your project's Gemfile.

gem 'ansi'

And run then bundle command.

RubyGems

To install with RubyGems simply open a console and type:

$ sudo gem install ansi

Setup.rb (not recommended)

Local installation requires Setup.rb (gem install setup), then download the tarball package and type:

$ tar -xvzf ansi-1.0.0.tgz
$ cd ansi-1.0.0
$ sudo setup.rb all

Windows users use 'ruby setup.rb all'.

Release Notes

Please see HISTORY.md file.

License & Copyrights

Copyright (c) 2009 Rubyworks

This program is redistributable under the terms of the FreeBSD license.

Some pieces of the code are copyrighted by others.

See LICENSE.txt and NOTICE.md files for details.