A summary of data about the Ruby ecosystem.

https://github.com/kigster/colored2

112M downloads and counting! ANSI colors in your terminal, simple as it can be. An updated and maintained fork of the original gem "colored" by @defunkt
https://github.com/kigster/colored2

Keywords from Contributors

rack activejob activerecord mvc

Last synced: about 12 hours ago
JSON representation

Repository metadata

112M downloads and counting! ANSI colors in your terminal, simple as it can be. An updated and maintained fork of the original gem "colored" by @defunkt

README.md

RSpecs
Rubocop

Gem Version MIT License Gitter

Colored2

The most downloaded ANSI color gem you'll find :-)

Gem Total Downloads

Backstory

It's an actively maintained fork of Chris @defunkt Wanstrath's gem colored, which appears to be no longer supported. So instead of accepting this as a pull request, a new gem was born.

This fork comes with a slightly spruced up syntax, some additional features, and a test suite written in RSpec.

Please Consider Donating


Usage

In addition to the simple syntax of the original gem, which affected only the string to the left of the method call, the new "bang" syntax affects a string to the right. If the block or a method argument is provided, the contents is wrapped in the color, and the color is then reset back.

If no block or argument is provided, the color is left open-ended, and must be explicitly reset – when using the 'bang' notation.

Complete set of colors:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white

Complete Set of Effects

Note: previous versions used method name clear instead of no_color, which clashed with many 3rd party frameworks that defined similarly named method in the global namespace.
This highlights the dangers of introducing so many words into the String namespace.

  • no_color
  • bold
  • dark
  • italic
  • underlined
  • reversed
  • plain
  • normal

Usage in Other Classes

With this gem you can add color to not just strings, but to any other class. String class is automatically decorated as soon as require 'colored2' is parsed by the ruby interpreter. Note that future versions may refrain from auto-requiring colored2/strings, and rely on explicitly requiring components they need colorized, eg require 'colored2/numbers'.

To color numbers, require the following file, which automatically decorates Integer and Float. You can also add color methods to the Object. Finally, you can add the methods to any custom class by including the Colored2 Module.

Below is an IRB — session that shows a slightly more advanced usage.

Additional Helpers

There are several additional helpers tucked onto the String class.

  • #to_bol (to beginning of the line) will rewind the cursor back to the beginning of the current line.
  • #to_eol (to end of line)

Installation

Add this line to your application's Gemfile:

gem 'colored2'

And then execute:

$ bundle

Or install it yourself as:

$ gem install colored2

Development

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Support

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kigster/colored2.

License

The gem is available as open source under the terms of the MIT License.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 7 days ago

Total Commits: 52
Total Committers: 6
Avg Commits per committer: 8.667
Development Distribution Score (DDS): 0.442

Commits in past year: 10
Committers in past year: 1
Avg Commits per committer in past year: 10.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Konstantin Gredeskoul k****r@g****m 29
Konstantin Gredeskoul k****g@w****m 12
Chris Wanstrath c****s@o****g 6
orta o****x@g****m 3
Tim Meusel t****m@b****e 1
Caio Chassot d****v@c****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 21 days ago

Total issues: 4
Total pull requests: 14
Average time to close issues: 10 days
Average time to close pull requests: 8 months
Total issue authors: 4
Total pull request authors: 6
Average comments per issue: 5.25
Average comments per pull request: 0.57
Merged pull request: 9
Bot issues: 0
Bot pull requests: 0

Past year issues: 2
Past year pull requests: 6
Past year average time to close issues: 14 days
Past year average time to close pull requests: 5 minutes
Past year issue authors: 2
Past year pull request authors: 2
Past year average comments per issue: 3.0
Past year average comments per pull request: 0.67
Past year merged pull request: 4
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/kigster/colored2

Top Issue Authors

  • jerrypaulsam (1)
  • felipesabino (1)
  • olimorris (1)
  • neomilium (1)

Top Pull Request Authors

  • kigster (7)
  • fossabot (2)
  • soudai-s (2)
  • gitter-badger (1)
  • bastelfreak (1)
  • orta (1)

Top Issue Labels

  • bug (1)
  • fixed-please-verify (1)

Top Pull Request Labels


Package metadata

gem.coop: colored2

This is a heavily modified fork of http://github.com/defunkt/colored gem, with many sensible pull requests combined. Since the authors of the original gem no longer support it, this might, perhaps, be considered a good alternative. Simple gem that adds various color methods to String class, and can be used as follows: require 'colored2' puts 'this is red'.red puts 'this is red with a yellow background'.red.on.yellow puts 'this is red with and italic'.red.italic puts 'this is green bold'.green.bold << ' and regular'.green puts 'this is really bold blue on white but reversed'.bold.blue.on.white.reversed puts 'this is regular, but '.red! << 'this is red '.yellow! << ' and yellow.'.no_color! puts ('this is regular, but '.red! do 'this is red '.yellow! do ' and yellow.'.no_color! end end)

  • Homepage: http://github.com/kigster/colored2
  • Documentation: http://www.rubydoc.info/gems/colored2/
  • Licenses: MIT
  • Latest release: 4.0.3 (published 11 months ago)
  • Last Synced: 2025-12-09T09:33:20.009Z (3 days ago)
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 207,165,647 Total
  • Docker Downloads: 601,528,225
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.067%
    • Downloads: 0.117%
    • Docker downloads count: 0.151%
  • Maintainers (1)
rubygems.org: colored2

This is a heavily modified fork of http://github.com/defunkt/colored gem, with many sensible pull requests combined. Since the authors of the original gem no longer support it, this might, perhaps, be considered a good alternative. Simple gem that adds various color methods to String class, and can be used as follows: require 'colored2' puts 'this is red'.red puts 'this is red with a yellow background'.red.on.yellow puts 'this is red with and italic'.red.italic puts 'this is green bold'.green.bold << ' and regular'.green puts 'this is really bold blue on white but reversed'.bold.blue.on.white.reversed puts 'this is regular, but '.red! << 'this is red '.yellow! << ' and yellow.'.no_color! puts ('this is regular, but '.red! do 'this is red '.yellow! do ' and yellow.'.no_color! end end)

  • Homepage: http://github.com/kigster/colored2
  • Documentation: http://www.rubydoc.info/gems/colored2/
  • Licenses: MIT
  • Latest release: 4.0.3 (published 11 months ago)
  • Last Synced: 2025-12-08T18:22:33.596Z (4 days ago)
  • Versions: 5
  • Dependent Packages: 77
  • Dependent Repositories: 34,358
  • Downloads: 207,074,089 Total
  • Docker Downloads: 601,528,225
  • Rankings:
    • Downloads: 0.131%
    • Dependent repos count: 0.18%
    • Docker downloads count: 0.197%
    • Dependent packages count: 0.386%
    • Average: 3.342%
    • Forks count: 9.168%
    • Stargazers count: 9.992%
  • Maintainers (1)
proxy.golang.org: github.com/kigster/colored2

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/kigster/colored2#section-documentation
  • Licenses: mit
  • Latest release: v4.0.3+incompatible (published 11 months ago)
  • Last Synced: 2025-12-08T18:22:34.885Z (4 days ago)
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 6.637%
    • Stargazers count: 7.14%
    • Average: 8.539%
    • Dependent packages count: 9.576%
    • Dependent repos count: 10.802%

Score: 26.397000668485838