File: ansicode.rb

# ansicode.rb

Path: | lib/more/facets/ansicode.rb
Last Update: | Tue Aug 10 17:25:06 -0600 2010

# ANSICode

Module which makes it very easy to use ANSI codes. These are especially nice for beautifying shell output.

      include ANSICode

      p red, "Hello", blue, "World"
      => "\e[31mHello\e[34mWorld"

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

## Supported ANSI Comands

The following is a list of supported codes.

        save
        restore
        clear_screen
        cls             # synonym for :clear_screen
        clear_line
        clr             # synonym for :clear_line
        move
        up
        down
        left
        right
        display

        clear
        reset           # synonym for :clear
        bold
        dark
        italic          # not widely implemented
        underline
        underscore      # synonym for :underline
        blink
        rapid_blink     # not widely implemented
        negative        # no reverse because of String#reverse
        concealed
        strikethrough   # not widely implemented

        black
        red
        green
        yellow
        blue
        magenta
        cyan
        white

        on_black
        on_red
        on_green
        on_yellow
        on_blue
        on_magenta
        on_cyan
        on_white

## Authors

- Florian Frank
- Thomas Sawyer

## Speical Thanks

Special thanks to Florian Frank. ANSICode is a partial adaptation of ANSIColor, Copyright (c) 2002 Florian Frank, LGPL.

## Todo

- Need to add rest of ANSI codes. Include modes?
- Re-evaluate how color/yielding methods are defined.
- Maybe up, down, right, left should have yielding methods too?

## Copying

Copyright (c) 2004 Florian Frank, Thomas Sawyer

[Validate]