https://github.com/rubyworks/ansi
Set of ANSI Code based classes and modules for Ruby
https://github.com/rubyworks/ansi
Last synced: 10 months ago
JSON representation
Set of ANSI Code based classes and modules for Ruby
- Host: GitHub
- URL: https://github.com/rubyworks/ansi
- Owner: rubyworks
- License: bsd-2-clause
- Created: 2009-09-07T01:38:18.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2023-11-08T16:53:57.000Z (over 2 years ago)
- Last Synced: 2024-12-24T12:59:24.757Z (about 1 year ago)
- Language: Ruby
- Homepage: https://rubyworks.github.com/ansi
- Size: 1.77 MB
- Stars: 117
- Watchers: 6
- Forks: 33
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ANSI
[HOME](http://rubyworks.github.com/ansi) ·
[API](http://rubydoc.info/gems/ansi/frames) ·
[ISSUES](http://github.com/rubyworks/ansi/issues) ·
[SOURCE](http://github.com/rubyworks/ansi)
[](http://travis-ci.org/rubyworks/ansi)
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](http://github.com/rubyworks/ansi/tree/master/qed/)
or the [API documentation](http://rubyworks.github.com/ansi/api/index.html).
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](http://github.com/rubyworks/ansi/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.