Created
October 24, 2014 00:33
-
-
Save dbarrionuevo/4fa27c8d8d17482fab56 to your computer and use it in GitHub Desktop.
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
| module Colors | |
| def colorize(text, color_code) | |
| "\033[#{color_code}m#{text}\033[0m" | |
| end | |
| { | |
| :black => 30, | |
| :red => 31, | |
| :green => 32, | |
| :yellow => 33, | |
| :blue => 34, | |
| :magenta => 35, | |
| :cyan => 36, | |
| :white => 37 | |
| }.each do |key, color_code| | |
| define_method key do |text| | |
| colorize(text, color_code) | |
| end | |
| end | |
| end |
roperzh
commented
Oct 24, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment