Created
August 4, 2013 18:15
-
-
Save KINGSABRI/6151293 to your computer and use it in GitHub Desktop.
colorizing
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 Xss | |
| module Ui | |
| module Console | |
| module Prints | |
| module Color | |
| # | |
| # Colorize String class extension. | |
| # | |
| class String | |
| def red; colorize(self, "\e[1m\e[31m"); end | |
| def green; colorize(self, "\e[1m\e[32m"); end | |
| def dark_green; colorize(self, "\e[32m"); end | |
| def yellow; colorize(self, "\e[1m\e[33m"); end | |
| def blue; colorize(self, "\e[1m\e[34m"); end | |
| def dark_blue; colorize(self, "\e[34m"); end | |
| def pur; colorize(self, "\e[1m\e[35m"); end | |
| def bold; colorize(self, "\e[1m"); end | |
| def colorize(text, color_code) "#{color_code}#{text}\e[0m" end | |
| end | |
| end # Color | |
| end # Print | |
| end # Console | |
| end # Ui | |
| end # XSS | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment