Project

cape-cod

0.0
No commit activity in last 3 years
No release in over 3 years
CapeCod offers you simple stupid way of colorizing and applying effects to your terminal output, by appending ANSI escape sequences to your strings.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.0.0.beta1
 Project Readme

cape-cod

[Gem Version] (http://badge.fury.io/rb/cape-cod) [Build Status] (https://travis-ci.org/fuadsaud/cape-cod) [Code Climate] (https://codeclimate.com/github/fuadsaud/cape-cod)

cape-cod makes it easy for you to append ANSI escape-codes - HAR! bet you didn't see that coming - to your strings.

Hey, but don't we have a plenty of gems that do exactly the same thing?

YES. We can cite colored, colorize, term-ansicolor, ANSI and so on... They are really nice gems, and they solve the escape code problem in different manners but they're all kind of abandoned, with a lot of lingering issues...

My point with this gem is to implement many of the possible ways of appending ANSI escape codes to strings (monkey patching, blocks, etc) and let the user choose whatever he likes. I for instance prefer the colored's monkey patch approach, but for some people it doesn't suit, so other options should be offered.

Please contribute!

Installation

Add this line to your applications's gemfile:

gem 'cape-cod'

then run:

bundle install

or simply:

gem install cape-cod

Usage

require 'cape-cod'

You can include cape-cod in you String class:

require 'cape-cod/string'

class String
  include CapeCod::String
end

puts "OHAI".red

puts 'This is BOLD'.bold

puts 'and this is ITALIC'.fx(:italic) # You're not using this, right?

puts 'Black n white'.fg(:black).on_white

puts 'Magenta background'.bg(:magenta)

puts 'ZOMG THERE'S RGB AS WELL' background'.bg(220, 112, 234).fg(0xa30fd4)

or use it like this:

puts CapeCod.yellow('We all live in a yellow submarine!')

puts CapeCod.fx :bold, 'BOOM!'

puts CapeCod.fg(255, 0, 255, 'Super magenta!')

All the public instance methods are available as module methods.

License

Please refer to LICENSE.md.

Contributing

Check the guidelines at CONTRIBUTING.md.

Bitdeli Badge