fun_with_string_colors¶ ↑
Paint your strings for prettier console output. Behold! The Code of Exampleage!
require 'fun_with_string_colors' FunWith::StringColors.activate # imports functions into String String.colorize( true ) # Yes, we want those functions to add color codes to strings. String.colorize( STDOUT.tty? ) # only alter strings if we're in TTY (console) puts "Hello World".paint(:pink) # Pretty shiny! puts "Hello World".paint(:bg_red, :blue, :bold, :underline, :blink) # An affront to God and Man, I tells ya. # If your first arg to .paint() is a regular expression, only the matches will be colored in. Useful! puts "Hello World".paint(/hello/i, :bg_red).paint(/world/i, :bg_blue, :reverse, :underline) String.paint? # Is painting active? "".paint? # Same question. One setting controls all strings. puts String::ANSI_COLORS.keys.inspect # What symbols does paint recognize?
Contributing to fun_with_string_colors¶ ↑
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.
-
Fork the project.
-
Start a feature/bugfix branch.
-
Commit and push until you are happy with your contribution.
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright¶ ↑
Copyright © 2014 Bryce Anderson. See LICENSE.txt for further details.