•  


GitHub - 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
Skip to content

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

License

Notifications You must be signed in to change notification settings

kigster/colored2

 
 

Repository files navigation

RSpecs Rubocop

Gem Version Gitter

Colored2

This is an actively maintained fork of Chris (defunkt) Wanstrath's gem colored , which appears to be no longer supported.

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

Please Consider Donating

Donate using Liberapay Donate using Liberapay

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 .

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 .

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본