Sha256: c4903c1f2165ca7a9721fbc21b6df17b2799b16595d5693290433022ec07af69
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
# ansi_color Add some simple methods that allow you to colourise and style your Strings with lovely Ruby syntactic sugar. ## Contributors [Kacper Cieśla][comboy] improved print and puts loads with this [commit](http://github.com/comboy/ansi_color/commit/a66e3baf47aef2d3d60495c65a6a83153e7fa688). Thanks for your contributions [Kacper][comboy]! ## Examples require 'rubygems' require 'ansi_color' AnsiColor.print('plain string') # => "plain string" AnsiColor.puts('plain string') # => "plain string\n" AnsiColor.print('coloured string', :color => :red, :background => :black, :effects => [:blink, :bold]) # => "\e[31;40;5;1mcoloured string\e[0m" AnsiColor.puts('coloured string', :color => :red, :background => :black, :effects => [:blink, :bold]) # => "\e[31;40;5;1mcoloured string\e[0m\n" AnsiColor.red # => 31 AnsiColor.red_background # => 41 AnsiColor.blink # => 5 ## Adding colour methods to String ### This doesn't work properly! Chaining methods works but isn't particularly ingenious. require 'rubygems' require 'ansi_color' class String include AnsiColor::String end 'coloured string'.red.bold.blink # => "\e[5m\e[1m\e[31mcoloured string\e[0m\e[0m\e[0m" [jcf]: http://github.com/jcf [comboy]: http://github.com/comboy
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jcf-ansi_color-0.4.1 | README.md |
jcf-ansi_color-0.4.2 | README.md |