Created
February 27, 2013 03:59
-
-
Save bluerabbit/5044943 to your computer and use it in GitHub Desktop.
rubyで標準出力に色付けるやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class String | |
| def colorize(color_code); "\e[#{color_code}m#{self}\e[0m"; end | |
| def red; colorize(31); end | |
| def yellow; colorize(33); end | |
| def pink; colorize(35); end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment