Skip to content
This repository

Set of ANSI Code based classes for Ruby

branch: master
Octocat-spinner-32 demo Use markdown instead of rdoc format. [admin] December 08, 2012
Octocat-spinner-32 lib Change :clear_line to clear whole line and add :cursor_show and _hide… December 10, 2012
Octocat-spinner-32 task Add email to metadata. [admin] November 05, 2011
Octocat-spinner-32 test Add test helper. [test] November 05, 2011
Octocat-spinner-32 work Add work notes file. [admin] June 18, 2012
Octocat-spinner-32 .gitignore Track QED.rdoc for rubydoc.info, for now. [admin] November 11, 2011
Octocat-spinner-32 .index Use Index.yml instead of Metadata file. [admin] December 10, 2012
Octocat-spinner-32 .travis.yml Fix rbx entry in travis config. [admin] January 29, 2012
Octocat-spinner-32 .yardopts Adjust yardopts. [admin] November 05, 2011
Octocat-spinner-32 Assembly Use markdown instead of rdoc format. [admin] December 08, 2012
Octocat-spinner-32 Config.rb Make Config.rb visible and adjust. [admin] May 27, 2012
Octocat-spinner-32 DEMO.md Use markdown instead of rdoc format. [admin] December 08, 2012
Octocat-spinner-32 Gemfile Add support for Travis CI. [admin] November 04, 2011
Octocat-spinner-32 HISTORY.md Change :clear_line to clear whole line and add :cursor_show and _hide… December 10, 2012
Octocat-spinner-32 Index.yml Use Index.yml instead of Metadata file. [admin] December 10, 2012
Octocat-spinner-32 LICENSE.txt Try to comply as much as possible to ASF standards. [admin] December 08, 2012
Octocat-spinner-32 MANIFEST Use markdown instead of rdoc format. [admin] December 08, 2012
Octocat-spinner-32 NOTICE.md Try to comply as much as possible to ASF standards. [admin] December 08, 2012
Octocat-spinner-32 README.md Use markdown instead of rdoc format. [admin] December 08, 2012
Octocat-spinner-32 ansi.gemspec Use traditional gemspec location. [admin] December 08, 2012
README.md

ANSI

HOME · API · MAIL · 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

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.

Something went wrong with that request. Please try again.